Small optimization - replace Array.forEach with simple for loop