Update the flow merging code