finished exercise 5.8