Factor nested merge into two methods