Fix styles and refactoring