Small tweaks to code and structure