my changes to chacematrix.R file