Rewrote the gmerge suite of functions