Added cacheable matrix functionality