Miscellaneous code optimizations.