Finished problem 1 and first 2 parts of problem 3