comments added and code mods