log the stack trace of the errors
small refactoring and cleanup
updated README