Improving the sorting feature