adding my version of cachematrix