Cosmetic changes and refactoring