Adding code for cachematrix