Optimizations

Code optimizations.