moved logic and saved access token