fixed some hmod problems, implemented C-H matrices
improved efficiency in modular cases