my edited version of cachematrix.R