make previous changes for other sort functions