Formatting and refactoring