added merge func