Updated Chapter 3 code.