Fixed exercise 1.7 solution