add some work on problem 6 but still incomplete