more work on hw5. Exercise 3 works.