some minor changes to code