Committing exercise 8 from chapter 7