recursive merger