finished first code draft for problem 2