refactored scrape task, dividing long set of create record funcation into small pieces