Updated heapsort.