merging.mergeGids first output, seems to work. Modified savePrimitives to take maps.