Working gen_tokens.sh