Final version of Exercise 2