Exercise 4.4 resolved