fixes and clarifications
optimize logging
minor refactoring