corrected for to endfor