Committing exercise 7 from chapter 4