more tweaks and bug fixes.