Added a cache check. This only checks if the cache file has been created so we check if it needs to be created before we use it.