Performance optimizations.
Minor cleanup.