Second refactoring exercise