added comments and removed extra output
fixed typo