fix problem 2 and add problem 3 and 4