simplify heap.c