Exercise 1-4 working towards assignment 4.