Fixes #41
improved logging
refactored logging