Several small optimizations.