Implemented caching matrix