add enviornemnt
fix the double iteration logic to not go over the limits