Breaking down callback hell into separate functions in scraper