Clarifying Code

addition of comments and removal of errors