further polishig problem 2 and problem 3
almost done with problem 3, some more polish with problem 4