Optimize iteration