completed version of cacheMatrix.R