Updated the token logic