added comments, minor edits