added comments, minor changes