final version exercise 7