logging and bugfixes

* fixed an issue, where multiple threads were created
+added logging and statistics
* commenting