Optimizations

Various optimizations.

In total: TBC