add RegionMerger
refine code