One of the enduring questions fans have after watching Star Wars: The Force Awakens involves the galaxy’s most seasoned astromech droid: R2-D2.

J.J. Abrams has opened up about the tough little droid’s story arch, and what follows are spoilers from the film – so maybe save this until after you’ve seen it.

…

Midway through The Force Awakens, Han Solo, Chewbacca, Finn, and BB-8 make their way to the Resistance base, where they discover that R2 has been in a coma-like “low power mode” for years – the robot version of crushing depression over what transpired between his now absent master, Luke Skywalker, and the Jedi trainee who betrayed him, Kylo Ren.

At the end of the film, R2 suddenly wakes up, and the reason is somewhat mysterious – which has led some fans to wonder what finally roused the droid from his vegetative state.

At a post-screening Q&A for the movie on Saturday, Abrams and co-writers Lawrence Kasdan and Michael Arndt explained why they sidelined R2 – and why he finally had his own “awakening.”

“The whole movie is a series of character introductions,” says Arndt, who help craft the story before Kasdan and Abrams penned the script. “You want all your character introductions to be A-plus. You want to give each person their moment. Even the Millennium Falcon. That was [producer] Bryan Burk’s idea. They’re running to get a ship, it blows up, and you turn and there’s the back-up – the Millennium Falcon.”

If an iconic starship gets a scene-stealing moment, then certainly R2-D2 deserved one, too. But the writers grappled with a way to make his re-emergence special.

“I had originally written R2 and C-3PO showing up together, and Larry very intelligently said, ‘You want to keep them separate from each other. And of course I’m like, ‘No, no, no, Larry. You don’t get it at all!’” Arndt joked, drawing laughs from the audience – as well as the screenwriter of The Empire Strikes Back and Return of the Jedi sitting beside him.

Then Arndt says he got it: R2-D2’s arrival had to be presented as a kind of delayed gratification, building up the audience’s expectation before the droid rolls out and starts beep-blooping.

As the writers tried to find a logical place for that, they also grappled with the question of how to present Mark Hamill as Luke Skywalker – who, as those who’ve seen The Force Awakens already know, was also held back as a climactic reveal in the final minutes of the movie.

“Early on I tried to write versions of the story where [Rey] is at home, her home is destroyed, and then she goes on the road and meets Luke. And then she goes and kicks the bad guy’s ass,” Arndt said. “It just never worked and I struggled with this. This was back in 2012.”

The trouble was a simple case of upstaging. “It just felt like every time Luke came in and entered the movie, he just took it over,” Arndt said. “Suddenly you didn’t care about your main character anymore because, ‘Oh f–k, Luke Skywalker’s here. I want to see what he’s going to do.’”

The good news for Abrams was, he got to make a Star Wars movie. The bad news was, his toybox wouldn’t include a real-life Luke Skywalker action figure. Some of the early MacGuffins of the movie – the thing that drives a movie’s plot — were a search for Darth Vader’s remains, or a quest to the underwater wreckage of the second Death Star to recover a key piece of history about sacred Jedi sites in the galaxy.

Ultimately, the writers decided to make Luke himself the MacGuffin – the thing Rey, Han, Finn and Chewie are trying to find. And they figured that if a horrific past trauma forced Luke to retreat from the world, maybe the same could be said of R2. The droid’s physical form is still present, but his personality is not – lost in the miasma of grief over what transpired in the past.

When they find R2 beneath that dust cloth, the heroes already have a piece of a holographic map, but they lack the larger section of this uncharted region of space that will allow them to track down Luke. That’s where R2 became a useful storytelling device: he could be the missing framework.

The story group’s thinking went back to the 1977 original movie, when R2-D2 accessed the Empire’s mainframe as the heroes searched for the captured Princess Leia. “We had the idea about R2 plugging into the information base of the Death Star, and that’s how he was able to get the full map and find where the Jedi temples are,” Arndt said.

Abrams says he chose to spell this out indirectly in the movie because he didn’t want the story to get bogged down in “how s–t happened 30 years ago.”

“But the idea was that in that scene where R2 plugged in, he downloaded the archives of the Empire, which was referenced by Kylo Ren,” Abrams said. Thirty-eight years later, in both our own and galactic time, that data becomes useful in The Force Awakens when a new droid approaches the dormant R2.

“BB-8 comes up and says something to him, which is basically, ‘I’ve got this piece of a map, do you happen to have the rest?’” Abrams said. “The idea was, R2 who has been all over the galaxy, is still in his coma, but he hears this. And it triggers something that would ultimately wake him up.”

The director acknowledges that R2’s sudden “awakening” at the end was designed to be an emotional storytelling utility: “While it may seem, you know, completely lucky and an easy way out, at that point in the movie, when you’ve lost a person, desperately, and somebody you hopefully care about is unconscious, you want someone to return.”

So for those let wondering: BB-8’s earlier question rattles around inside R2’s dome for a while. Those old astromechs must just take a while to boot up again.

Then as the movie draws to a close, our old friend finally comes back – and leads us to another one.