Revert "Copying remainders outside the while saves on bounds checking inside the while for a nice speedup"

This reverts commit cf98b8b88d4a5f72d384ce729cf0438082fbda1c.
Fixed test for is sorted.