Refactoring in groups cache handling code, CS fixes