solution to 1,2,3,5,6 and 7 added