updated cachematrix with code