Rearranging and adding second assignment (problem 14)