Refactoring exercise