Added some validation over token generation