extract and peek for heap