initial porting for gauge_merge tool