Logging cleanup, optimizations