handle multiple common roots

Testing Done:
tests!

+manually

Reviewed at https://rbcommons.com/s/twitter/r/1153/