add ancestorsML code that I meant to make more readable

(but never did)