Chapter 2 code examples