return value is incorrect, since you will now return next_token as well as endpoints.