exercise 2.17, 2.18, 2.20