While working on his film adaptation of Rumaan Alam’s Leave the World Behind, screenwriter and director Sam Esmail got an assist from Barack Obama.

Esmail talked to Vanity Fair about the upcoming movie, telling correspondent Anthony Breznican that the former president—who executive produced the film along with his wife, Michelle Obama—gave him notes about the adaptation.

The novel and film follow two couples who are forced to share a Long Island home when a mysterious blackout hits New York, leaving them without television, Internet, or cell phone service.

Esmail said Obama’s experience with managing crises helped spur him to suggest that some of the events in the screenplay were a little too dire.

“In the original drafts of the script, I definitely pushed things a lot farther than they were in the film, and President Obama, having the experience he does have, was able to ground me a little bit on how things might unfold in reality,” Esmail said. “I am writing what I think is fiction, for the most part, I’m trying to keep it as true to life as possible, but I’m exaggerating and dramatizing. And to hear an ex-president say you’re off by a few details…I thought I was off by a lot! The fact that he said that scared the fuck out of me.”

Leave the World Behind stars Mahershala Ali, Myha’la Herrold, Julia Roberts, and Ethan Hawke. It is scheduled to premiere in theaters on Nov. 22 before streaming on Netflix 16 days later.

Michael Schaub is a contributing writer.