Updated Heap code