cleanup and cache