Pilots often change dramatically from the time they’re filmed to the time they air. Rachel Dratch played Jane Krakowski’s character in the original 30 Rock pilot; the upcoming NBC comedy Powerless is now set at a superhero-protection-device company instead of an insurance company.

But few shows have made as extreme a transition as Sneaky Pete, the drama that premiered on Amazon Prime Video January 13. If you've watched the first episode and thought, Hmm… this seems like it belongs on CBS instead of Amazon, you’d be right on the money: the original pilot, developed by Emmy winner Bryan Cranston and House boss David Shore, was created for the Eye network. And its procedural bent was no accident.

Cranston first got the germ of an idea for the series at the Emmys, while accepting his final Emmy win for playing Walter White in Breaking Bad. During the speech, he told a story that he hoped would resonate with actors who hadn’t had as much good fortune as he had.

“I said, ‘You know, when I was a kid, I came from a challenging childhood and I was looking for shortcuts in my life, and circumventing responsibilities that were given to me and all of that,” he tells Vanity Fair. “I realized that I didn't have a passion in my life. It wasn't something that I was connected to, until I found acting.”

He took so many shortcuts that his family eventually gave him a nickname: they ”referred to me as ’Sneaky Pete,’ because I was that guy. I was sneaky.” The next day, the president of Sony’s television division gave Cranston a call and asked if Sneaky Pete could be a series about someone who never grew out of taking shortcuts.

“I thought, I think he would be a criminal. He could be a con man. I had been working with the idea of trying to find a series in the world of bail bonds and nothing was . . . I couldn’t crack it,” says Cranston. “I didn’t know where it was, and all of a sudden, this seemed to be the right home for it.”

He and Shore fleshed out the idea and pitched it to CBS’s then head of programming, Nina Tassler. “We designed it to be more of a procedural, which is in their wheelhouse, and pitched it to them. She really took to the idea,” says Cranston. “David wrote a really great pilot, and I was hands-on from the very beginning, reshaping, and tried to strengthen certain aspects of it. It was a good collaboration.”

The idea: a con man named Marius (Giovanni Ribisi) is on the run after being released from prison, because he owes a gangster a ton of money. He decides to assume the identity of his chatty cellmate Pete, who has told him chapter and verse about life with his grandparents on their Connecticut farm. Grandma Audrey (Margo Martindale) and Grandpa Otto (Peter Gerety) have not seen Pete in decades, so they reluctantly invite Marius not only to stay, but to work in their bail-bonds business as a “skip tracer”—trying to catch people who skip bail, along with their granddaughter Julia (Marin Ireland).

For whatever reason, the pilot didn’t lead CBS to order Sneaky Pete to series. But Sony wasn’t going to give up on the show. “The first place we stopped at was Amazon,” says Cranston, “and they said, ‘We really like this pilot. It’s not exactly what we want, but we feel like it could be. We want it serialized, so can you wash off the broadcast aspect of it and retool it to make it a serialized show?’“

Cranston and Shore only had three weeks to write and shoot additional material, including an appearance by Vince, the violent mobster who tries to flush out Marius by using his brother (Michael Drayer) as collateral. When it came to who would play the character, “we just didn’t have the luxury of time to take our time to find the right person. At which point, the producer in me said, ‘O.K., we got to hire Cranston because he’s available,” says a deadpan Cranston. “‘He fits the wardrobe so let’s just get him and get him in there.’”

After Amazon ordered the show to series, Shore left without much warning; according to Cranston, he said that the show needed someone with a different sensibility than his. As a replacement, Cranston suggested Graham Yost, the executive producer of the FX hit Justified, who had just come off making a pilot that wasn’t picked up. A lunch meeting between the two convinced Yost to come aboard as show-runner.

What was Yost’s plan for the show? “With a streaming show . . . you can afford to go fully serialized right from the beginning,” he says. The additional scenes added when the pilot moved from CBS to Amazon “showed us roughly where a big serialized story could go. David and Bryan gave us the engine right there. [Marius has] got to save his brother.”

Yost and his team, many of whom worked with him on Justified, were up to the challenge of transforming a show that was already on the air. “It was just a blast. It’s a really interesting problem,” says Yost. “We really picked it apart. It was like we were given this sort of foundational document, and then we had to extrapolate from that.”

Some characters, like Pete’s youngest cousin Carly (Libe Barer), completely changed directions between the first version of the pilot and the one that debuted in January. “We decided we wanted to keep her out of it,” says Yost. “We felt that it was irresponsible to involve a 16-year-old girl in a situation where there is a bad guy.” As an added bonus, “by taking that out, I think maybe [the procedural part of the pilot] feels a little shorter.”

But it is still there, which might make viewers feel a little put off—or confused when they hit the button for Episode 2 and find a completely different tone, with characters who suddenly have the freedom to say words like “fuck” and “shit.” Cranston, for one, isn’t worried.

“I actually think it might be interesting to them, where if they know a little bit of the history then they’ll realize, ‘Oh, this is how a television show is created. It’s designed for one thing and then reimagined for another.’ Quite frankly, I think we were given a gift. We didn’t know it at the time, but we are able to allow Sneaky Pete to become fully realized under the freedom that a studio like Amazon provides.”

Through pure serendipity, Cranston (who also directed an episode of Sneaky Pete) is acting on live-action series TV for the first time since Breaking Bad ended. Yost found ex-cop turned mobster Vince so fascinating that he ended up making him the “big bad” of Season 1, putting him in all of the remaining nine episodes.

“He loves being in this business and getting to perform,” says Yost about Cranston. “I don’t think he feels like, ‘Oh God, I’m going to have to go in and be Vince in order for this series to get some traction.’ It’s like, ‘Man, I get to be this bad guy. Let’s see what you guys are going to come up with for me.’“

“You cannot be risk-averse and be a successful actor,” says Cranston. “I knew looking at that character, when I was thinking of it from an actor’s standpoint, ‘Oh, this could be juicy. This could be fun because he’s the villain. He’s the main bad guy. This is great.’“

His performance includes a chilling, four-page, eight-minute monologue at the end of Episode 4. Initially, it had been cut down during the writing process—but again, Cranston’s role as E.P. works to the viewer’s advantage. “He gets the early drafts of the script, and so he said, ‘Yeah, no, I’ve already memorized the four-page version, so let’s do that. You can always trim it in post,’“ says Yost. Sometimes, even on television, things work out for the best.