Exercise 16, 17, 18, 19 and 20.

Signed-off-by: Salil Kanitkar <slashforu@gmail.com>