Rewrite the internal sort algorithms.