avoid using [] operator in the for loop and change variable names