Minor loop optimizations.