Completed hw5. Left 'extras for experts' for later.