added more comments and edits