solved up to problem 4