Rian Johnson reveals it was Fisher who wrote some of Leia's most memorable final lines of dialogue.

“Star Wars: The Last Jedi” is now playing in theaters around the world, and with it comes Carrie Fisher’s final turn as Princess-turned-General Leia Organa. Director Rian Johnson had previously revealed back at Star Wars Celebration in April that Fisher had helped with the script, calling the actress a “brilliant writer and an incredible mind.”

“I would go to her house. We would sit on her bed for hours and go through the scripts,” he said. “We would have these stream of consciousness jazz poetry kinda ad-lib sessions. I would just scribble on my script everything she said, and at the end of six hours, there would be like a four-word line of dialogue that was the distillation of all of that that was brilliant.”

Now Johnson has revealed to The Daily Beast exactly which lines Fisher came up with for what are now Leia’s final scenes in the “Star Wars” franchise. To no one’s surprise, Fisher was responsible for some of her character’s most humorous and touching lines of dialogue.

[Editor’s note: Spoilers for “The Last Jedi” follow.]

One of Carrie’s biggest contributions to the script occurs during the scene in which her character is finally reunited with her brother, Luke Skywalker (Mark Hamill). The scene takes place inside the Resistance base during the climactic battle against the First Order on the mineral planet of Crait. Luke appears inside the base, and it’s the first time the two siblings have appeared on screen together since “The Return of the Jedi.” To break the tension of not seeing her brother in many years, Leia memorably jokes that she changed her hair.

“[Carrie] loved one-liners and jokes,” Johnson tells The Daily Beast. “She could just pop out so many jokes. So the whole thing where she sits down with Luke and [says], ‘I changed my hair,’ obviously, that was her.”

Fisher was also partly responsible for writing the goodbye between Leia and Amilyn Holdo (Laura Dern). Holdo has decided to remain on the ship while Leia and the rest of the Resistance board small transport vehicles to escape the wrath of the First Order. The two women say goodbye by using the trademark “May the force be with you.” Johnson reveals it was Fisher who came up with the highly emotional exchange.

Holdo and Leia attempt to say the line together at the same time but struggle as they fight back tears, knowing this will probably be the last time they see each other. Leia humbly says through her tears: “You go, I’ve said it enough.” Holdo then gives the most emotional “May the force be with you, always” of the entire film.

“That whole Holdo scene, that goodbye scene was actually completely rewritten with Carrie and with Laura,” Johnson says. “The three of us got together and worked through it.”

According to Johnson, Dern also helped tremendously with the moment. “The real heart of that scene came from Laura. It was her saying, ‘I just feel like, from my character to Leia, but also me to Carrie, I want to express what she means to me. I want to express my gratitude.’”

“Star Wars: The Last Jedi” is now playing in theaters nationwide.

Sign Up: Stay on top of the latest breaking film and TV news! Sign up for our Email Newsletters here.