Updated cacheMatrix.R for Programming Assignment 2