abstract over heap structure
some fixes