Contains codes from Chapter 5, from Dromey's book