New code for cachematrix.