Finalised exercise 3