solved up to problem 9