Implement improved caching and more debugging tools