Broke apart part A of the second problem