finished up to problem 9