Updated Heap sorting