General perfomance optimizations.