My completed version of the cachematrix.R script