Corrected sorting