added encryption option and other token generation method