refactor cowgrou