Added caching for keys