cache code refactor, no external changes