Worked through exercise 4.8