Remove some more duplicated code