Adding solution to exercise 13