Completes exercise 8 - book