Chapter 5 sample code