refactor invite token stuff