Spoiler alert: this article contains plot twists from the finale.

After so many lugubrious turns, “Breaking Bad” came to an end on Sunday on an almost uplifting note.

Walter White died, of course, but first he ran the table of revenge, settling score after score with mathematical precision. He went out with a big finish: his ingeniously rigged machine gun mowed down the entire Aryan Brotherhood gang in a fantastical killing spree that was almost like a scene from a Quentin Tarantino movie. (As bad guys go, the next best thing to a Nazi is a neo-Nazi.)

It was a fitting ending, and predictable in only some ways. Crime didn’t pay and Walter lost just about everything, including his life. But it was also, by the show’s bleak, almost Calvinist standards, a relatively happy ending. It wasn’t, as he so often feared, all for nothing – he found a way to get his money to his children. He also saved Jesse, actually taking a bullet for him by throwing himself on top of the younger man to protect him from the machine gun fire. He even made up with his wife, Skyler.

It was way too late for contrition, but there was a confession and even a kind of deathbed conciliation. Walter for the first time told Skyler the truth about his reason for cooking meth and becoming a drug lord. “I did it for me. I liked it. I was good at it,” he said. “And I was really, I was alive.”