Exercise 2 solution