adding exception handling and consolidating scraping functions