Exercises 10, 11, and 12 from greenteapress