implement heap and heap tests