removed extra endfor