Finish refactoring and styling