Fixes and performance tweaks.