When Girls was in production on its second season, director Richard Shepard was sent the script for the fifth episode. He read through his assignment and felt something was off. The story featured the cast sitting around and reminiscing, flashing back to earlier points in their relationships and filling in backstories. The show had briefly used this gimmick during its debut season, revealing the first time an incapacitatedly stoned Marnie (played by Allison Williams) met her boyfriend Charlie (Christopher Abbott) back at Oberlin, just as they were breaking up in the present. While that backward glimpse provided a deeper emotional context, Shepard didn’t think this new collection of memories amounted to much.

So he said something about it, which is what he does when he thinks there’s a problem. Shepard went to coshowrunners Lena Dunham and Jenni Konner and told them, "I think the script’s really funny, but I don’t know what the episode is about. There doesn’t seem to be a point to it, and there’s no heart to it."

In the hierarchy of most television making, the director is a far more skilled laborer than auteur. They’re hired to execute other people’s ideas while using an existing stylistic template. It’s usually not the director’s place to bluntly tell the person who happens to be the creator, star, writer, and director of 30 percent of all its episodes that the script is kind of bunk.

Admittedly, Shepard’s situation was different. Back in Season 1 he was the first director who wasn’t Dunham ever entrusted with an episode, and he was also Konner’s boyfriend. He carried more than two decades worth of experience shooting TV pilots and helming indie features, too. But that didn’t mean he had a pass to just do whatever. "Lena, instead of saying, ‘Go fuck yourself,’ said, ‘I don’t disagree with you, and I’ve actually been thinking about that,’" remembers Shepard. Then he adds, "She chooses which ideas to listen to and which she doesn’t, and she certainly doesn’t listen to every idea, but she’s open to them."

Asked about that day, Dunham recalls, "I went home and went to dinner with my father and told him a loose idea for an episode where Hannah meets an older man. My dad pitched the idea that the guy was named Joshua and hated to be called Josh. I went into my bedroom at my parents’ house and wrote all night and handed it straight to Richard, who said, ‘It’s insane and I love it.’"

The resulting replacement, "One Man’s Trash," has become one of the defining episodes of Girls. Eschewing most of the cast, it follows Dunham’s character, Hannah, as she shares two days with Joshua (played by guest star Patrick Wilson) that are filled with sex, grilled steaks, roleplaying domesticity and, eventually, a one-sided session of overwhelmed oversharing. It felt more like a short story than a 30-minute TV show. But it also gave more depth to Hannah’s character, accessing a type of vulnerability that she hadn’t yet revealed to her friends.

Over the years Shepard went on to direct the show’s two other self-contained "bottle" episodes: Marnie and Charlie’s unexpected reconnection in "Panic in Central Park," as well as "American Bitch," one of this final season’s most talked-about episodes. The latter again found Hannah alone in the home of an older, successful man — this time she’d been drawn into a cruel trap that was sprung through questions about gender, power, and sexual dynamics.

And while these three pieces stand out for their formal differences from the rest of the series, they don’t represent Shepard’s entire contribution to the show. He’s directed 12 episodes over the six seasons, and nearly each one has been great. In road-trip episodes, he traveled upstate to meet the father of Jessa (Jemima Kirke) in the bitter kiss-off "Video Games" and brought Hannah to her grandmother’s deathbed in "Flo." He also masterfully handled full-cast episodes like "Sit-in" and "Hello Kitty," the emotional pivot points of Seasons 4 and 5, respectively. This weekend brings "The Bounce," which helps set up the show’s final run. It’s Shepard’s last episode for the series, and while it’s not showy or boundary breaking, it has moments that are tender and fantastic and so fucking upsetting. It also takes Girls’ long history of comic dance sequences to their inevitable uppermost level with a Broadway play based on a movie from the ’90s.

Girls mainly draws from a small collection of directors, and aside from Dunham and producer Jesse Peretz, Shepard has handled more episodes than anyone else. Describing his approach, Konner says, "He has the clearest vision of what he wants of anyone you’ll ever meet. He is the most decisive person." Dunham is more lyrical: "He runs the set like a benevolent Jewish general, and he has the soul of Bergman meets Mel Brooks."

Shepard, 52, grew up on New York’s Upper West Side. He got his formal education at NYU in the 1980s. When he’s working on an episode of Girls, he says he’s conscious of being the oldest man, if not the oldest person, on set. (It’s a claim that Konner dismisses with the comment, "We also have Jesse and Judd [Apatow]; we’re lousy with older men.") He’s been directing since the early ’90s, and has made seven features over the decades, including The Matador and Dom Hemingway. Prior to Girls, most of his involvement in television was directing pilots. Shepard says that aside from Girls, he sticks to pilots because it’s usually the only time a director gets to be intimately involved in the creative process. Then he reveals it’s also a financial choice — every time any subsequent episode of the show comes out, you get a check, no matter if you worked on it or not. Directing Girls indulges both needs: The work is fulfilling, and gets it him noticed for more pilot gigs.

Even with this history, directing "Hannah’s Diary," the fourth episode of the first season (and Shepard’s first), wasn’t an easy experience. "The first two days of directing on Girls, that was about as stressful as anything I’ve ever done," Shepard says. "My girlfriend is the showrunner, so I don’t want to ruin that relationship. Lena is like the greatest person in the world. I don’t want to ruin that relationship. I don’t want to be the guy who directed the lame episode of Girls and then never came back again. I dealt with it as I usually do, by pacing and eating a lot of donuts."

Dunham had previously directed everything she had written — her short films, her debut feature Tiny Furniture, and the first three episodes of her show. Directing the entire run of the series wasn’t an option, but there had to be a level of trust with anyone she was going to cede that responsibility to. Through Konner, Shepard had already become close with Dunham. She admired his films. He had even tried (and failed) to teach her how to drive a car. "I considered him a friend and a mentor, but on the first day I couldn’t stop giving unnecessary, useless notes," Dunham remembers. "The second day my voice was mysteriously lost. That can’t be a coincidence."

Girls was still gaining its footing back then, and there were practical aspects of being a director that Dunham simply didn’t know how to do yet. From Shepard and Peretz she would learn things like how to shoot a scene with lots of extras. In "Hannah’s Diary," Shepard used a dolly for a tracking shot, something the show hadn’t even done until that point. The episode went well enough that Shepard was given another episode to direct later that season, and then the collaborations didn’t stop.

Shepard and Dunham both got their big breaks when they were in their mid-20s, though they happened two decades apart. Due to the divergent ways these opportunities shook out, Shepard often speaks of Dunham with a clear reverence. While Girls has incited controversies and was uneven during its middle seasons, it will be remembered as one of the shows that defined HBO, and television, this decade. And while people anticipate what Dunham will do next in film or TV, she has already published the memoir Not That Kind of Girl and started an email newsletter and production company with Konner. Shepherd’s career instead unfolded in a way that no one would envy.

When Shepard was 25 years old, he directed his feature debut, The Linguini Incident, a hyperstylized send-up of downtown New York in the early ’90s that starred Rosanna Arquette and David Bowie. Arquette had seen the script Shepard cowrote in her agent’s office. Intrigued by its terrible title, she read it and decided she wanted to be in it. This all came together right after the breakout success of Steven Soderbergh’s Sex, Lies, and Videotape, when producers and distributors realized that tiny budgeted indies had the potential for massive returns in profits. Video companies started financing movies, and one kicked in a third of The Linguini Incident’s $3 million budget.

"We basically had no money, no cast, no anything, and suddenly Rosanna Arquette wanted to do the movie. It became a very legitimate movie," Shepard remembers. "On a whim we sent the script to David Bowie to play a small role, and David Bowie called back and was like, ‘I’d like to star in the movie.’ It was one of those beautifully blessed events, and so, you know, I fucked it up in editing and sort of made this bloated, not-such-a-really-great film. With the hubris that only a 25-year-old could have, I believed that my film was great, without really showing it to too many people or listening to too many people. Not only was it a total disaster financially, but it was a film I couldn’t even show to people later on because I was unhappy with it." (The film’s calamitous reception wasn’t helped by the fact that it came out the weekend of the Rodney King riots, when the National Guard was patrolling Los Angeles and the city was under a dusk-until-dawn curfew.)

For more than a decade after The Linguini Incident, Shepard tried to stay afloat as a director, making a few more not-particularly-well-received indies when he could. Then Pierce Brosnan, coming off his stint as James Bond, decided he wanted to star in The Matador, a black comedy Shepard wrote about a dejected, aging hitman. It was Shepard’s first film to find any critical praise. "When I made The Matador, for most people in the business, it was like my first movie," he says. That led to work shooting pilots for shows like Criminal Minds and Ugly Betty, whose long runs provide Shepard with a steady paycheck, and, more importantly, time. "Suddenly it allowed me to make documentaries, to make short films, to go and do other features," he says. "The two years before The Matador, I had a movie shut down. I was broke. I mean, literally broke. I won the Emmy Award for Ugly Betty and I almost said in my speech that I found it really amusing to win an award for directing television when Time Warner Cable had turned off my television two years ago because I couldn’t afford to pay my bill, which was true."

Since Girls debuted in 2012, Shepard has directed Dom Hemingway, another mean little comedy about criminals. Given this current niche, the young neurotics that define Girls might not seem like a fitting match. But after seeing Hemingway, Dunham and Konner decided they had to create a role for actor Richard E. Grant, who became Jessa’s coconspirator from rehab. The sensibilities of Girls may also be rubbing off on Shepard, too. Next month at the Tribeca Film Festival, he’ll screen his 32-minute short, Tokyo Project, a romance that’s set across the Japanese city starring just Elisabeth Moss and Eben Moss-Bachrach (who plays Desi on Girls). Konner also mentions that the the script that Shepard just finished and might direct next has a female lead. "I feel like we maybe had something to do with that," she says.

Reflecting on the differing ways his and Dunham’s careers have progressed, Shepard says, "We were both given an opportunity at a similar age and Lena sort of figured it out from the very beginning. It took me another 20 years till I got good at what I was doing."

Eric Ducker is a writer and editor in Los Angeles.

Disclosure: HBO is an initial investor in The Ringer.