caches and refactor