Adding extensive test for threaded scraping, cleaned up code.