added merge_closest method