More refactoring, more style cleanup