Exercise 3.6 resolved