added merge algo