My changes to cachematrix function