code samples from the book