Major optimization of Problem 14, beginnings of Problem16 (not functional at all).