Sorting Functionality Fix