logging improvements and debug cleanup