Tweaks to code