refactoring, cache handling