few changes to code