Tweaks and bug fixes