let res_comb node found _ =
   (* only return something when we have reached a goal *)
   if found then Some node else None