Refactoring and polishing