Exercises 7-9 (these need merging for ref)