Refactoring and styling