changes to chchematrix.R