Added code comments and log output

* added code documentation and a few comments
* added log outputs
Removed log output