updated get_token method