Simplify stack iteration