better caching and logging