Refactored scraping functionality.