Cleaning up heap sort