Code examples from Chapter 2