refactoring exercise