Added new sorting algorithm by IDs