cleaned-up ingestor code