formatting applied to most of the source code to tidy things up, and misc refactors (commit: e52371a)
change enum format back to old style (commit: 3c853a2)
remove some unused code (commit: 87277a0)