Updated code for Chapter 14