remove whitespace
move common code into its own header