More loop optimizations.