This month begins the first half of the fifth and final season of Breaking Bad. In the 46 episodes that have aired thus far, (nominal) protagonist Walter White, a former chemistry teacher turned meth lord, has dissolved three human bodies in hydrofluoric acid and strangled a man with a bicycle lock. He has witnessed a legless would-be assassin drag his bloody stumps across a hospital floor. He has seen two planes collide above his house and watched as flaming debris plummeted into his swimming pool. Twice he has been so convinced that he was about to die that he recorded farewell messages for his family.

Sorry, spoiler alert.

This is dark stuff. It’s like watching The Sopranos, except that every week you have to watch Adriana get murdered all over again. (Again, spoiler alert—but seriously, watch the show already.) Still, while the program is deeply disturbing, it’s not really depressing. There’s something downright thrilling—life-affirming, even—about it. And that’s because, whatever else it may be, Breaking Bad is the most immaculately engineered show in television history.

Structurally, Breaking Bad is like an iPad: pared down to its essentials, with no unnecessary buttons, extra parts, or confusing menus. Practically every scene advances Walt’s descent into amorality. There are only a half dozen or so main characters—remarkably few for a series of this length—and most of them are there to provide a counterpoint to the melody of Walt’s character arc.

Showrunner Vince Gilligan is single-minded in his focus on Walt, and he directs all the storytelling toward that goal. “I like the idea of constraints,” Gilligan says, sounding a bit like Apple design guru Jonathan Ive. “Without them, the show could go anywhere. In theory that sounds like a good thing, but there’s a real danger it could start to ramble.”

Part of the fun of Breaking Bad comes from watching the elements of an elaborate plot interact like the gears of a Swiss watch. Walt’s wife, Skyler, helps her boss, Ted, cook his books, which means he gets investigated by the IRS, which Skyler knows could result in her (and Walt’s) phone getting tapped, which means she must help Ted pay off the debt, which means she has to dig into Walt’s cash hoard, which means that Walt doesn’t have the money, in a moment of desperation, to pay someone to erase his identity. This takes two seasons to play out, and the payoff is a chilling scene in which Walt appears to give up all hope of survival. Even as you cringe at Walt’s fate, you get a rush from watching the puzzle pieces slide into place.

The puzzle analogy, it turns out, is no accident. The show’s writers’ room is filled with puzzles—3-D foam jigsaws, old blacksmiths’ metal contraptions, a Rubik’s Cube.

“One of my writers is like Rain Man, just assembling them and taking them apart as he’s talking,” Gilligan says. “One makes hundreds of these origami structures. That’s what they do while they’re thinking.”

Despite Breaking Bad’s edgy subject matter, this structural integrity makes the show truly satisfying in an oddly traditional way. Gilligan isn’t out to play with his audience’s expectations or subvert their ideas of what television should do. His purpose is to entertain, and he has built a magnificent machine to do it.