caching and speed improvements