Adding exercise 2 solution