Logging refactored