created cachmatrix code