Not sure the function is right.  Will check more carefully.