Optimized loop