minor improvements to code.