Add cachematrix functionality