updated cachematrix functions