More tweaks and bug fixes.