Sorting input research subset when sorting output data