First half of the first assignment for HW2.