Code samples from Chapter 2