solved exercise 3