Added optimizations.