final tweaks to code