merge fn