total restructuring of `heap`