refactored MR code between ingest and recreate