Exercise 3.4 resolved