tacify for loop code and test