Complete changes to cachematrix.R code