Various code optimizations.