Adding exercise 6 from chapter 2.