More miscellaneous reformatting and refactoring