minor mods and added some comments