improvements to code