edit index with endfor