Remove some now redundant code
Miscellaneous reformatting/refactoring