Some sorting enhancements