Avoid setting variables within for() loops