added merge code, not quite right