Some bucle optimizations.