most of problem 6 done