added token checking