counter cache refactoring