Added code to save iterator in procloop in stack