Exercise 16.4 from chapter 16