Bunch of optimizations.