More tidying, prep to some refactoring
Refactoring; turn on warnings; fix some problems