Added caching to improve performance