Exercise 4.1 resolved