documented logging functionality and improved internals