small refactor, improved logging setup