updated hasToken and added isValidDomain