changing end of for loop