example code in book