Fleshed out the cache matrix functions