solved exercise 21.1