Optimized for loop.