Removed irrelevant comments and commented logging code.
Removed irrelvant comments and commented code
Fixed logic error