Exercise 3.12 resolved