completes problem 6