added possible solution for exercise 9