Ch9 exercise 1 complete. Dubbed from mhartl git repo