refactored merge_tree of LineTree