added the cache matrix code