Finished exercise 2 of section 3.5