my take on the cachematrix script