Finished exercise 3 of worksheet 1.