Correct sort with remembering