Finished chapter 12 exercise