Chapter 5 code completed