updated cachematrix with functions