Improved sort for numeric values