Completely refactored that atrocious mess of differences-of-squares.