Add composite chain resolution (kinda)
This needs to be changed to using a longer ID for chains and assuming
no collisions.