Changes to clean up for loops

added variables for array[i] code