Solution to exercise 10