Some logging improvements and caching improvements