small code clean up and better test
Make ancestors() accept In and Out as inputs.
Fix the last clone with shared variables issue I think.

TODO document why.