changed Heap so that it can work with any objects that implement the
HeapNode interface. Also added comments and some exception handling.