Solution for Exercise 8.