Loop optimizations.