Adding Exercise 5 from chapter 2.