Tentative final code for cachematrix.