minor modifications to hw_6 (problem 2 seems to need more work)