modified cachematrix.R