Set up for loop for second function