Various tweaks and fixes