My 2nd version of cachematrix function