Maybe we can extract some methods from this quite big method (like the handling of the token in a separate method) ?