polishing and refactoring