minor fixes and added comments