exercise 20, with some tweaks
exercise 21
exercise 24
exercise 25
exercise 26
exercise 29
exercise 30
exercise 31