refactor scrapecsw logic