Refactor generate script and add collection stats