Move cache delete so it doesn't end up re-caching the old data later in the function