completed data extraction script