Added checkHeap() method