update merging logic, however, still incomplete