Why does this look completely different from your other heap? Could you merge some of the code?