Writing cachematrix.R with updates