Updated R file cachematrix for peer review assignment