Cleaner logic for edge_chain.