cleaned up batch querying and token refresh functionalities