Changed token generation algorithm