Tweaks and bug fixing