Solution to the exercise