Refactor Logging. Fix style.