Use lru_cache to cache results