adding code for cachematrix