Did various reformatting and refactoring