first modification to cachematrix.R