Finish exercise 2.15
Finish exercise 2.16, copied and modified from exercise 2.15