Added caching to indexing