Modified cachematrix.R with caching code