Updated ORDER BY logic to match new objects.