added code to cachematrix