Added heap foreach function.