Remainder of solution for exercise 2.12