more documentation and log refactoring