General optimizations.