Exercise 3.29 resolved