final version of my cachematrix.R file