Added functionality to better diagonalize cohomology group.