New cachematrix code