Exercise 3 complete but probably not in the best possible way