More refactoring and styling