Exercise 3 in chapter 8