Assignment 6, second try.  Copied a lot from course material for this
one.