combined extract.py and extract_data.py into one file