last changes to cachematrix script