Lots of work on problem 2