[Warning: The following contains spoilers for the Season 12 finale of Doctor Who. Read at your own risk!]

Doctor Who went back to Gallifrey on Sunday night, and as promised, it was explosive. The Season 12 finale, titled "The Timeless Children," shook the foundations of the Doctor's (Jodie Whittaker) identity, revealing a game-changing secret buried deep in her own past. Also, the Cybermen wore Time Lord headdresses. There was something for everyone.

But the biggest twist of the Season 12 finale — aside from the fact that Graham (Bradley Walsh), Ryan (Tosin Cole), and Yaz (Mandip Gill) all made it back to present-day Earth alive, despite heavy foreshadowing that we might be losing a companion this episode — was the answer to the mystery of the Timeless Child. It's confirmed: The Child is the Doctor.

Discover your new favorite show: Watch This Now!

The Master (Sacha Dhawan) brings his best enemy to the charred remains of Gallifrey and lays it all out: Gallifrey is not the Doctor's home planet. She comes from another dimension. When she was young, she was adopted by an early Gallifreyan, who eventually discovered the Child's regenerative powers and turned her into a test subject. Over time, Gallifreyans were able to splice the ability to regenerate into their genetic makeup, so they gave themselves a pompous new name — Time Lords — and became the ruling elite. The one part of this twist that doesn't surprise the Doctor is that the Time Lords are the worst.

As for why she doesn't remember any of this, last week's "Ireland" subplot involving Brendan (Evan McCabe), the cop who couldn't die, is our biggest clue. The Time Lord Matrix has redacted most of the Child's history, but Brendan's story was hidden in the system: The stereotypical Irishness was just a visual filter put over the Timeless Child's story so it wouldn't be noticed. This means it's a safe bet the Doctor's memories were erased, as Brendan's were — maybe multiple times. What we do know is that the Child went on to serve for a secretive Time Lord unit called the Division. We also know the Doctor lived a lot of lives before the childhood she remembers on Gallifrey, which explains where Jo Martin's history-making Doctor fits into the picture. It also explains the Morbius Doctors, introduced in the 1976 story "The Brain of Morbius," from the Tom Baker years. Classic Doctor Who fans are popping bottles tonight!

But history can only take the Doctor so far. Martin's Doctor gets the line of the night when she appears to our Doctor to help her process her new origin story, reminding her, "Have you ever been limited by who you were before?" As much as this episode is concerned with the past, Doctor Who has to be rooted in hope for the future — if it weren't, it wouldn't mean anything that the show is still breaking new ground with its title character. Coming from the show's first black Doctor to its first female Doctor, the line felt like a reminder that progress is always possible, even in the midst of reckoning with a society that's built on exploitation.

Doctor Who Stars Unpack Season 12's Deep Dive Into the Doctor's Past

As for the rest of the episode, the shortest version is that the Master lets loose. He converts all the dead Time Lords on the planet to Cyber Masters, merging Cyber technology with the Time Lords' regenerative powers. If the Cyber Masters ever left the planet there would be no stopping them, so the Doctor decides to sacrifice herself to save the universe. The key is a death particle, contained in the Lone Cyberman's suit, capable of wiping out all organic life on the planet. After reuniting with her fam on Gallifrey (heck of a way to show her friends her home), the Doctor sends them back to 21st century Earth in one of Gallifrey's many vintage TARDISes (TARDII?). "Have great lives," she tells her friends, giving me real Ninth Doctor-saying-goodbye-to-Rose vibes. Then she straps the miniaturized Lone Cyberman to a bomb and prepares to detonate it, knowing it will also kill her.

The Master tries to talk her down using the old "this makes you a killer like me" argument, which is frankly tired and the Doctor should know better. (I think she did; I'm guessing her hangup was with killing the Master more than anything.) Right as she hesitates, Ko Sharmus (Ian McElhinney) arrives to detonate the bomb in the Doctor's place, giving her just enough time to make a break for it in another TARDIS. Does this mean we've seen the last of Sacha Dhawan's Master? Consider this my official plea to showrunner Chris Chibnall: Logic has never applied to the Master before, and it shouldn't start now. Bring back Dhawan's Master!

Anyway, there's just enough time for one final surprise. The Doctor gets back to her TARDIS only to be intercepted by the Judoon, who put her under arrest and zap her to a space prison. What better way to end a season than with a baffled "What??!" from the Doctor? See you all back here for the holidays.

Some notes:

-"Look upon my work, Doctor, and despair" was a low-key way to pay off saving Percy Shelley's life, and I respect it.

-"Are you suffering comfortably? Then I'll begin."

-I cried at Graham's compliment to Yaz. It also definitely made me think one of them would die. How long can this fam dodge terrible consequences?

-Love how underwhelmed the Master is by robots. "What if we workshop this?"

-"Oh shoot, I should've said, 'Somebody needs to cut you down to size,' then zapped you."

-"Yaz, I can't get this hat off."

Doctor Who returns to BBC America for a holiday special at the end of 2020.