Update HeapIterator to be more efficient with variable use.