Solve Exercise 3.13

... with a little bit of help, of course