Minor refactoring in exercise 1.8