Added merging algo.