Added first half of problem 1.