It's appropriate that the majority of Gotham's Season 2 finale is set in an insane asylum. The sophomore outing for Fox's elongated Batman origin story has been on a creative high all year, and thankfully sticks the landing on the way out. It doesn't end anywhere near where you would have expected after the beginning of the season, and certainly not where anyone expected after the decidedly mixed first season.

But what Gotham discovered over the past 22 episodes is something that the Batman movies discovered long ago: embrace the insanity of the Dark Knight's villains over the gritty goodness of Batman himself, and you'll win.

It wasn't always supposed to be this way. Bypassing the normal pilot process, Fox ordered Gotham directly to series from Mentalist showrunner Bruno Heller in 2013. Initially, Fox announced that the show would focus on future Bat-ally Jim Gordon (Ben McKenzie), and wouldn't feature Batman at all. But things changed behind the scenes, and later it was announced that a young Bruce Wayne (David Mazouz) would appear, as well as a few very young future Batman villains.

Gotham began airing a year later, and by all rights came out of the gate strong, following through on Fox's confidence in the project. The premiere deftly mixed the best of the filmic Bat-mythos, liberally picking parts of every iteration from 1966 on. But despite the strong start, and a winning cast, the high of the first episode was short-lived.

As Season 1 wore on, Gotham had an increasing amount of trouble figuring out what it was; the tone that jelled so seamlessly in the pilot started to unravel as time went on. Was it a gritty, realistic take on superheroes, like Christopher Nolan's movies? Was it arch and gothic like the Tim Burton films? Or was it — as best exemplified by Jada Pinkett Smith's Eartha Kitt-inspired mob boss Fish Mooney — a goofy romp like Adam West's Batman TV show?

The tone wouldn't just change from episode to episode, it would vary wildly from scene to scene. Ultimately the weight of too many characters, too many plots, and far too many tones led to Season 1 nearly imploding.

There were definite high points: Robin Lord Taylor's Penguin/Oswald Cobblepot, so strong in the premiere, remained a highlight throughout, as did most of the future villains. But the desperate need to stretch out Bruce Wayne's origin to nearly impossible lengths was killing the show.

Robin Lord Taylor in <em>Gotham</em>Robin Lord Taylor in Gotham

Erin Richard's Barbara Kean provided the perfect metaphor for what was wrong with the show, and how it eventually worked its way out of the quagmire it found itself in. For most of the first season, Gordon's girlfriend seemed trapped in her own apartment, constantly badgering Jim for spending too much time focusing on the wrong things (i.e., his work instead of her, but you get the gist). By the way, I'm not joking: with few exceptions, for the first half of the season, Barbara stayed stuck in one room.

When she eventually left her apartment, she hooked up with — and was driven insane by — a murderous monster played by Milo Ventimiglia. She went mad and was tricked into killing her own parents, before slitting her own throat. This virtual act of suicide was as much a function of her character as it was a representation of the show screaming out in pain. It needed to kill its own parents — the plots it felt beholden to by three-quarters of a century of Batman continuity — and then kill the show it was before, so it could become something else.

By the end of Season 1, Gotham had culled the convoluted mob storylines it had started with — and focused on — ending with the death of Fish Mooney, removing the biggest name star in the show from the cast (sorry, Donal Logue).

In case you're wondering how much of this was happenstance, and how much was course correction: it was very much the latter. I've discussed this with cast members of the show before, and they've unequivocally stated that by the time the show aired, they were already well into filming the first season. There was no rehearsal, no sense of how the cast worked together. Gotham, perhaps because of the network's confidence, steamrolled ahead, and then had to change direction significantly in its second half.

When Gotham came back in Season 2, it was (like Barbara Kean) reborn. The first half of the season adopted a mini-series format, ditching the case-of-the-week format and instead aiming for a mini-event called Rise of the Villains. Here, Kean — now an insane villainess — joined together with a pseudo-Joker and other madmen to form a group called The Maniax. They proceeded to kill basically the entire Gotham police department, introducing the city — and the audience — to the sort of descent into anarchy that Batman fans love. And that was just in the first three episodes.

They also took care of one of the biggest things holding Gotham back from greatness. From the very beginning, these characters were all safe. We already knew the end of this story: Gordon becomes the commish; Bruce becomes the world's greatest (non-mouse) detective; and the villains are all villainy. But during the attack on the precinct, Gordon's superior Sarah Essen (Zabryna Guevara) was killed. Not a huge deal in the scheme of the world of the show, but those familiar with the comics knew she would eventually have an affair with Gordon, and be crucial to his development as a character.

By killing her off, Season 2 made a clear statement: we're breaking with Batman continuity. No one is safe. This is not the story you thought you knew.

From there, and throughout the back-half, titled Wrath of the Villains, Gotham stopped worrying about Batman continuity entirely, and instead concentrated on making a show that was actually fun to watch. Instead of embracing every Batman film and TV show, they concentrated on the Burton movies, to the exclusion of everything else.

Nowhere was that clearer than in the casting of Paul Reubens (Pee-Wee, if you're nasty) as Cobblepot's father. The inside joke? Reubens played the Penguin's father once before... In Burton's 1992 Batman Returns.

Like the Burton films, with their flights of whimsy and bizarre gothic visuals, Season 2 of Gotham was certifiably insane. Former Fish Mooney second-in-command Butch (Drew Powell) had his hand cut off, and replaced by a hilariously tiny mallet. Cobblepot took vengeance on his step-mother (Melinda Clarke) by cooking and feeding her two children to her for dinner. In the back half of the season, the show added BD Wong as delightfully arch mad scientist Hugo Strange, who reanimated the dead and gave them superpowers in a secret lab under Arkham Asylum.

BD Wong in <em>Gotham</em>BD Wong in Gotham

This, from a show that seemed dead set on presenting a grittily realistic gang war in Season 1.

More importantly, the show finally let the characters go where they were supposed to be all along. Yes, it's a little ridiculous to think that The Riddler (Cory Michael Smith), Mr. Freeze (Nathan Darrow), and nearly every other member of Batman's rogue's gallery are running around when Bruce Wayne still isn't old enough to vote. But that's part of the insanity, the sense that whatever you think you know about Batman's origin just doesn't apply to Gotham. Also? It's way more fun.

And in a surprising way, it's allowed the character relationships to deepen, and grow, too. Freed from an origin story that stretched out interminably while he hung onto the sidelines, Smith's Edward Nygma has been a delight all season long. Lord Taylor, too, has had a chance to explore the Penguin's family dynamics, as well as engage in true character growth that's not just in service of moving his chess piece around the board. Even Bruce Wayne, who spent only about 10 percent less time hanging around in one room with a fireplace in Season 1 than Barbara Kean, has had way more to do.

He's discovered multiple levels of conspiracy around his father's murder. He's learned how to be a (very, very honorable) criminal with the future Catwoman, Selina Kyle (Camren Bicondova). And he even entered a fight club with his butler Alfred (Sean Pertwee). For real. While child actors are often the weak point of a show (and by forcing Mazouz into the brooding "my parents are dead" Batman mode from Episode 1, he was), Season 2 has made Mazouz and Bicondova into bright young stars. Their plots have been exciting, emotional, and fun... and all Gotham needed to do was forget that it was trying to drag out a simple story over five to 10 years, and instead just get to the story.

All of this wouldn't work without the star of the show, McKenzie's Gordon. Unlike Nygma, Cobblepot, or even Wayne and Kyle, Gordon doesn't get to cut loose. He's been steadily unhinged over the course of the season — forced to commit murder, thrown in an insane asylum and jail. But through it all, he's been the tight-jawed hero. The show needs that, though. It needs the straight man for the literally crazy men to work off.

Thankfully, though, for McKenzie, he finally gets in on the fun in the season finale. Without getting into spoilers, the twists and turns involving Gordon — or more specifically, someone who is pretending to be Gordon — are laugh-out-loud funny, and make a strong argument for letting McKenzie loose more often.

It all comes back to that insanity, that craziness. And if the ending cliffhanger is any indication, Gotham isn't backing down in Season 3. If anything, it's doubling down on the craziness, and has even figured out how to make formerly problematic characters like Fish Mooney (yep, she comes back from the dead — with superpowers, of course) work into the new, more focused tone and narrative.

I say, bring it on. Who needs Batman, when the lunatics are running the (Arkham) asylum?

Gotham airs Mondays 8/7c on Fox.