modified R script -- cachematrix.R