Code examples for chapter 9