Exercise 4.6 resolved