Remove some accidentaly duplicated code. This needs urgent cleanup :(