Finished the Chapter 4 exercise