solution for final exercise 10