added functionality for leav merging