Merge logic.