worked through to end problem 6