Misc changes to code