refactor generate.sh: