Final version of exercise 2