Final submission 1c.
Passes our test cases and 'time' shows a real performance difference.