optimize the sort algorithm