modified cachematrix.R for assignment