Added code for generic Heap