Logging
More refactorings for #473