added solution for exercise 3