generate token final version and other improvements
generate token final version and other improvements