added cachematrix code