Initial work on refactoring GroupMatrix.