Solved exercise 3