added comments, minor tweaks