The Hollywood Reporter goes on set with season 5 of HBO's savage startup satire as Mike Judge, Alec Berg and their stars explore the suddenly under-fire digital industry and reveal the backstory behind Miller's departure: "T.J. wasn't LeBron."

Mike Judge sits perched before a pair of monitors, his fingers wrapped around his shaved head in a pose of high anxiety as camera operators and head-setted assistants swirl around him.

It's a Thursday afternoon in early February, and the 55-year-old perfectionist behind such cult hits as Office Space, Beavis and Butt-Head and this one, Silicon Valley, is back on the cavernous soundstage in Culver City, trying once more to nail the opening scene for his HBO comedy's fifth season — and its first without breakout star T.J. Miller. The actor who portrayed the series' blowhard entrepreneur Erlich Bachman exited at the conclusion of season four, and then promptly gave a vicious, rambling and widely dissected interview to The Hollywood Reporter in which he torched the "one-note" show and at least one of the "fucking idiots" behind it.

On cue, Miller's former castmates — Thomas Middleditch, 35, who stars as Pied Piper's brilliant but addled founder Richard Hendricks, and his nerd entourage of Gilfoyle (Martin Starr, 35), Dinesh (Kumail Nanjiani, 39) and Jared (Zach Woods, 33) — file onto set, a sharply lit, soulless office, and begin riffing.

NANJIANI You want us to work here? This is like a place they keep detainees awake for three days at a time and then they waterboard them. It's a fucking black site!

STARR A black site would be better because at least we'd be protected by the Geneva Convention.

NANJIANI I've spent my entire time in America trying to avoid places like this! I've had family members die in here!

STARR The good news is you're not brown in here. You're more of a neutral gray.

NANJIANI So it's not all bad …

By the time they're done, Judge's hands have relaxed into his lap, and he's hissing with laughter so loud you wonder whether it will distract the actors. It is pre­cisely the kind of comedic firepower that he and fellow show­runner Alec Berg, 49, the aforementioned Harvard-educated "idiot," are eager to display when the HBO comedy — until recently, the network's second-most-watched behind Ballers, and second-most-decorated behind Veep — returns March 25 for what is likely to be its penultimate season.

In the half-decade since the wry study of startup culture premiered, the ground has shifted beneath it — the public perception of the tech industry has dimmed considerably, as has the general appeal of a TV show built around five single bros. But rather than dwell on the increasingly charged climate or the departure of a beloved character, those still involved with Silicon Valley argue that a shake-up is exactly what a show entering middle age needs to feel fresh. "The truth is it can be pretty easy to get stuck in the formula and revisit the same rhythms, especially in a comedy," says Nanjiani, who picked up an Oscar nomination for co-authoring his own, The Big Sick, between seasons. "This forces the show to be different — and after four or five years, that's not such a bad thing."

Let's get it out of the way now. The decision to cut ties with Miller, 36, had been a long time coming. While nearly everyone associated with the series is loath to speak publicly about the events that led to the actor's departure, several make veiled references to his "demons" and the fact that he's been known to self-medicate with alcohol and other substances. Miller hasn't been shy about those vices either, wearing them at times like a badge of honor — or at least a solid launchpad for comedy, with bits that have hinged on his propensity to "drink till [he] passed out." There had been stretches when, multiple show sources say, he looked to have things under control, and others when he'd show up seemingly under the influence, if he showed up at all.

"There are a lot of different ways you can find out somebody doesn't want to do the show anymore," says Judge, seated now in his cluttered office on the Sony lot, a short walk from the set. "And it's not fun to work with someone who doesn't want to be there, [especially when] they're one of the main people and you've got however many crewmembers and extras and people who are [not paid as well] and they're all showing up before 7 a.m., and then are just like, 'Oh, OK, we're not shooting today.'"

Table reads would start late as the cast and crew waited on the untamable actor, and when he did arrive he typically hadn't cracked open the script. Schedules would regularly have to be rejiggered, and sources from the set recount tales of Miller falling asleep between takes, leaving cast and crew to nudge him awake. And though everybody involved with the series praises his raw talent — some even employing the word "genius" to describe him — many say it had become impossible to predict which Miller would show up on a given day. "There was almost a danger to having him around," says one insider. "He was explosive, and there were moments where you'd go, 'Whoa, that's not where I thought that was going at all, but that was fucking awesome' … but it was a trade-off." In the end, all parties involved decided it was best if he moved on.

"It just wasn't working," says Judge, who, in consultation with his producers and HBO, presented Miller with an offer: He could return for the series' fifth season, but only for three episodes, as a sendoff for the character. (The writing team hadn't settled on a specific storyline, though Judge says it probably would have involved Erlich and his foil Jian Yang on a road trip through China.) But Miller wasn't interested. Instead, he decided, he'd finish out season four (with Erlich waylaid at a Tibetan opium den), and that would be it. Sure, he'd be walking away from a beloved character and a few more paychecks, but at the time, he already had plenty on his plate between a burgeoning film career, including roles in Steven Spielberg's Ready Player One and Fox's Deadpool sequel, and his stand-up. (In December, those prospects diminished after an allegation of sexual assault by a former college classmate.)

Reached by phone in Alabama, where he was doing a set that night, Miller says in response: "In real life, I'm not always high like Erlich is. And this will blow your readers' minds, but I'm not high when I work because it gets in the way of the comedy. I also am not a guy who's blackout-drunk, bumping into things on set. … What was occurring was I was out doing stand-up all the time, even if it meant I only got three hours of sleep. So, the thing I have a problem with? It's pushing myself to do too much."

Even before Miller's departure, the character had started to become problematic for the show's writing staff, which was running out of ways to keep him involved in Pied Piper. Plus, losing Erlich's large footprint would not only force ingenuity but also open up opportunities for other members of the show's ensemble. The clean slate has Berg genuinely excited.

"These guys are the Golden State Warriors of comedy," Berg says, seated on a couch in his office with Wired magazine cover portraits of those actors hanging above. "So, it's like, yeah, we've lost Andre Iguodala but we still have Steph Curry and Kevin Durant and Klay Thompson and some other guy on the Warriors whose name I don't know. But I don't feel like we can't win championships anymore because we've lost …" He pauses there, and then rephrases, mixing his NBA superstars into a metaphoric cocktail: "T.J. wasn't LeBron." For what it's worth, Miller takes no issue with Berg's assessment, and, after requesting that it be repeated twice more, he laughs uproariously. "Oh, that's great," he says. "And it makes me like him more [because] he's so good at being an asshole."

***

When Silicon Valley premiered in the spring of 2014, Uber was still a controversy-free ride­sharing service and Facebook had yet to taint a presidential election. Back then, entrepreneurs were just starting to become celebrities, and celebrities entrepreneurs, and an HBO sendup — as Entourage had been to Hollywood — would solidify the shift from opaque subculture to pop mainstream.

Erlich Bachman was perfectly positioned as the tech world's answer to Ari Gold, and every major member of the current ensemble, save Middleditch, read for the part. While each offered a compelling take on a Valley-area archetype, none imbued a bombastic churlishness as expertly as Miller. "I saw T.J.'s silhouette coming down the hall for his audition, and just that was funny," says Judge, who'd worked with him on the 2009 film Extract. Still, those other actors — all of them comics, too — had impeccable timing and laugh-out-loud delivery, so Judge, himself a former engineer, fashioned roles for many of them. The other parts came easier: Richard Hendricks had been written with Middleditch in mind, and the late Christopher Evan Welch was a shoo-in for the part of oddball angel investor Peter Gregory.

That left Gregory's head of operations, Monica, for a time the series' sole female castmember. As the role was initially written, Amanda Crew feared she'd be playing more of a morally ambiguous seductress than the hard-driving venture capitalist that her Monica ultimately became. "I almost canceled my audition," she says, recalling her unease. In truth, HBO, which had been actively looking to line up a Valley-set series at the time, almost bailed on the project, too. The original pilot from Judge and his King of the Hill collaborators John Altschuler and Dave Krinsky had hung its narrative on two gold-digging women from Los Angeles who head to Silicon Valley in the hope of snagging the next Steve Jobs. HBO's executives were underwhelmed, if not altogether put off, by what came in. "We wanted women," says one, "but not like that."

As the story goes, Altschuler and Krinsky were unwilling to move forward without the women's storyline, and HBO was unwilling to do so with it. Silicon Valley would die there. Then came word from Judge. He'd understood HBO's concerns and was interested in taking another crack. In the months that followed, Altschuler and Krinsky exited the project, though not without retaining a created-by credit, and Berg, who'd honed his comedic chops on Seinfeld and Curb Your Enthusiasm, was brought in to help Judge reconceive the series. "We reshot half the pilot," recalls HBO's president of programming, Casey Bloys, who was running the comedy division at that point. "And what those guys turned in was a comedy that was genuinely funny and also had something to say."

The fawning among critics was close to universal. Time called it "the funniest out-of-the-box pay cable comedy in a good while," and USA Today said it was "smart, true, authentic and emotionally resonant." THR laid it on even thicker, describing the network's new half-hour as "flat-out brilliant … the best, most wide-appeal show that HBO has had in ages."

Four seasons in, reviews have remained generally kind, aside from a persistent critique about the show's scarcity of female characters. And though it regularly indulges in plenty of crude language and once devoted an entire episode to an elaborate dick joke (yes, really), it's remained surprisingly prudish with regard to nudity and sex. In fact, the series' only remarkable sex scene involved horses rather than people. Those unwritten rules about R-rated content come primarily at the directive of Judge, who even insisted that a stripper in the show's second episode be clothed. When asked about those decisions, Judge shrugs. "It all just makes me feel creepy and uncomfortable."

That discomfort dates back to the late 1990s, he says, when he was making his live-action directorial debut on Office Space. Judge was all set to shoot the film's already awkward sex-dream seq­uence when he learned that nobody had told the woman cast as Jennifer Aniston's leg double what she'd been hired to do that day. "I was like, 'Are you kidding me?'" he says now. "And then there were camera assistants being all creepy and saying things. … So, the whole thing, I just don't want anything to do with it." While on the subject, Judge lets slip that something similar had happened on Silicon Valley, where two non-HBO employees on his set were caught making inappropriate comments about a guest star on the show. To his knowledge, the pair was fired.

Don't expect to see issues of that sort explored onscreen, however. Though instances of harassment and discrimination have surfaced all over the tech industry, there will not be storylines drawn from, say, the various scandals at Uber or Ellen Pao's lawsuit against Kleiner Perkins. "We certainly aren't like, 'Oh, let's not talk about that,'" says Berg. "We talk about it all the time. The lack of hitting it head-on just comes down to the fact that we haven't done a great job of finding the definitive satirical take on it." So, for the time being, the show will stick to poking fun at the Valley's insidious bro culture — though even that, which once felt forward-thinking, could seem out of sync with the current moment, as Judge was reminded at February's Directors Guild Awards.

"There I was losing at the DGAs, and Amy Schumer makes this long speech about how [there are,] I don't know, too many white males and all that, and saying that every show should be 50 percent people of color," he says, with a trace of exasperation in his voice as he continues: "Well, if you're doing a movie about Nazi Germany, you can't do that. And if you're doing a TV show about tech that's satire, you can't do it." Judge has made his case before: If you're going to make fun of this world and the way it is, you have to show the way it is. "I don't think you do any service by pretending [Silicon Valley] is half female or half black," he adds. "And not to pin bouquets on ourselves here, but I think we brought some attention to the gender imbalance by doing this show."

***

While a vocal corner of the internet, like much of the entertainment press, has focused on the saga of Miller, Berg has been kept up at night by a more vexing challenge that the series was able to stave off until now.

That challenge, he says, is success — or the lack of it. To him, the appeal of Silicon Valley has long rested on the writers' ability to conjure up ever more creative ways for the Pied Piper gang to snatch defeat from the jaws of victory. In fact, Berg has often said in interviews that the show ceases to be compelling once the Bad News Bears, as he describes Richard and Co., have won. Judge isn't quite so hyperbolic, though he echoes Berg's concerns. "It's that fine line of if they become super successful and they're just rich and it's happily-ever-after, it's not as interesting or fun to watch," he says. "But if they keep failing, at some point you're going to go, 'OK, screw these guys. I'm tired of watching them screw up.'"

So, despite some misgivings, the start of season five will find Pied Piper flush with cash, moving into big-league office space and hiring aggressively — the gang's first extended experience with success since the series debuted. The actors, who share none of their boss' reservations about their change in fortune, are excited to play something other than losers for once. "Alec seems to think that if they ever get their money, the magic of being the underdog is gone," says Middleditch over coffee on his day off, "but I think there's plenty of drama in there — it's just a different kind of drama."

Fortunately, a byproduct of the series' popularity among the tech crowd is a deep well of experts to ensure the verisi­militude of this phase and every other in the startup life cycle. Among those in the show's Rolodex: former Twitter CEO Dick Costolo, who did a stint in the writers room, and V.C. heavyweight Marc Andreessen, who's been known to send story ideas, as well as bold-faced names like Facebook's Sheryl Sandberg (a Berg classmate from Harvard), LinkedIn's Reid Hoffman and Yelp co-founder Jeremy Stoppelman. The pro­ducers regularly take trips to the Valley, too, where they've been welcomed into the offices of Dropbox, Quora and Google; and the actors, who had varying levels of industry knowledge coming into the show, have been invited to host tech award shows, appear at product launches and, in a few cases, invest in startups themselves.

[promo:1092371]

Plenty of doors in Hollywood have opened as a result of the show's success, too — not that you'd know it if you caught the actors on set. (Between scenes, the group can usually be found playing Xbox in a grungy lounge, which they've facetiously dubbed "the bone zone.") Nanjiani credits the HBO comedy for giving him the clout to produce his Oscar-nominated screenplay, and Middleditch describes the series' impact as transformative. "Marvel's not knocking on my door to be Spider-Man or anything," he says, "but it literally went from the world of aspiration to the world of tactical selecting of projects." He's now the face of Verizon's ubiquitous ad campaign and has been busy lining up film roles during the show's hiatuses. (That at least a few of them have been as a romantic lead still tickles the gangly actor, who jokes: "I'm always like, 'Who wants to see me, this bird human, fall in love?'") Even Miller praises Silicon Valley for jump-starting his career.

The producers have found themselves in heavier demand as well, with Judge weighing a few other opportunities and Berg already splitting his time between Silicon Valley and another promising HBO comedy, Barry, about a hitman (Bill Hader) who wants to be an actor. With some sheepishness, both men acknowledge that they've tried to pass on, or at least share, showrunning duties with members of their writing staff for a couple of seasons now, but it hasn't taken hold. "Part of it is selfishness because I'm like, 'Wait, no, I don't want somebody else to do it,'" says Berg. "And part of it is that I came onto this show as a writer, and creating a machine that runs without you in the room is not something I've ever learned how to do."

Staying put has forced the pair to adapt to the ever-changing technology industry and how it collides with the real world. "When we started, the vibe was very much like, 'We cracked the code — you're welcome, world,'" says Berg, who with his writers got plenty of narrative mileage out of Silicon Valley's "we're not businesspeople, we're altruists" mind-set. But now, he surmises, "the tech business as a whole is starting to realize there's a darker side to what they've created, and they have to be accountable." He rattles off examples including "the realization that Twitterbots may have shattered a fundamental pillar of our democracy," "smart-home devices may or may not be listening into everything we're saying," and "antitrust clouds are looming over Google and Facebook." What this all means for Pied Piper is something that he and Judge have challenged themselves and their staff to think about carefully. Ultimately, Berg seems satisfied with the new direction. "Our protagonists are dreamers," he says, "and instead of dreaming of monetary success, there's actually starting to be a morality to what they're fighting for — in a silly way, they're actually trying to save the world."

When Silicon Valley returns March 25, those dreamers will be joined by a handful of new characters, including at least a partial robot, and noticeably more of Jian Yang, who's poised to benefit most from Erlich's exit. And while the latter's absence will inevitably be felt, in part because his elusive whereabouts are played for comedy throughout the season premiere, Judge insists the show will go on, as it did years earlier when they lost another fan favorite, Peter Gregory, after Welch's untimely death from cancer. "There is no question that T.J. is really funny and that Erlich was really funny," says Judge. "But I think there was only one time in the room where it was like, 'Oh, that would've been a good thing for Erlich.' There have been way more times where I've said, 'I wish we had Chris Evan Welch back.'"

This story first appeared in the March 7 issue of The Hollywood Reporter magazine. To receive the magazine, click here to subscribe.