Completed chapter 9 exercise