refactor scrape vars, and fs write outside loop
Merge pull request #1 from monking/master

refactor scrape vars, and fs write outside loop