updated cachematrix.R script