Remove some dead code and prettify slightly