third modification to cachematrix.R