optimize iteration