changed for loop conditions to integers