Chapter 4 and code examples