finished exercise 4-7