refactoring existing code formatting issues