move data-extraction logic to its own script.