Cachematrix completed code