Exercise on refactoring