Improved categorical label sorter to handle positive and negative values