refactoring in small steps