Some tweaks and optimizations.