Fixes and logging cleanup