Added optimized comparisonSort