Here’s what Doctor Who’s brand new Master was planning in “Spyfall.” Doctor Who returned with a bang on New Year’s Day 2020, delivering up a post-Christmas slice of spy flavored adventure that saw the Doctor enlisted by MI6 to investigate a series of attacks on Earth’s secret agents. Jodie Whittaker’s Time Lord traces back the problem to Daniel Barton (as played by Lenny Henry), who is in league with a previously unseen race of shapeless aliens. Along the way, the Doctor teams up with a former MI6 associate by the name of O, but a stunning twist reveals the character to be the latest iteration of the Master, who left the Doctor in an unknown realm and her companions crashing through the air in half a plane.

Picking up the action in part 2 of “Spyfall,” Yaz, Graham and Ryan track Barton to his base and uncover his role in the conspiracy, while the Doctor works her way through time and space, teaming up with renowned figures from history along the way, in order to understand the Master’s intentions and figure out a way to halt them. By the end of the story, of course, the Doctor has succeeded, saving the day and once again overcoming her best enemy.

As is typical of the character, and indeed arch-villains as a species, the Master’s plan is far from straightforward, involving multiple parties, varying timelines and trans-dimensional aliens to achieve the desired apocalyptic outcome. Here’s a complete breakdown of what the Master was trying to do in “Spyfall.”

What The Master, Barton And The Kasaavin Are Trying To Achieve

The Master admits to the Doctor that the alliance between himself, an Earthling businessman and a group of aliens he’s only just met isn’t entirely stable, and this is hardly surprising given that all 3 sides are looking to attain something different. Starting with the Master’s intentions, surprisingly the most simply of the bunch, Sacha Dhawan’s villain is once again trying to bring down the Doctor for the sake of victory over a rival. The Master is looking to wipe out the Doctor’s precious human race and bump his fellow Gallifreyan off at the same time, and he’s taken advantage of two other parties with aligned interests.

The Kasaavin are revealed to be spies from another dimension that have embedded themselves throughout the history of the universe, mostly to observe and obtain data for potential future use, but they find themselves on the brink of being discovered on Earth, hence the assassinations in episode 1. Forced into taking action, the Kasaavin are approached by the Master, who suggests a new plan for their coming out of hiding. The Kasaavin have the ability to wipe a person’s DNA, leaving them as a mere shell and, to the Master at least, this is as good a way of ending the human race as any. But erasing the planet one person at a time would be an arduous task. If only there was a way to ‘Select All’ on the human race…

Enter Daniel Barton. Having amassed a tech empire thanks to a nifty search engine and the accumulation of everyone’s data, Barton had apparently developed an apathy for the outdated human race and envisioned a new function for Earth’s population as massive hard drives for his beloved data. The Kasaavin would wipe the human race, while Barton and a select few others remain “sentient” to oversee the operation, thus the businessman effectively becomes the ruler of a desolate Earth full of human floppy disks. The Master has the vision, the Kasaavin are the muscle and Barton has the technological infrastructure.

How The Master’s Plan Would’ve Worked

No small amount of preparation goes into the Master’s latest wicked plan. Barton describes himself as “proof of concept,” which strongly suggests part of his DNA was wiped as a test run for the Kasaavin attack, explaining his 93% percent human scan results. After all, what price is 7% of your DNA when the entire world is up for grabs? Meanwhile, the Master discovers that the Kasaavin can’t move as freely between their world and Earth as they’d like to, so he builds them a machine in the form of the Silver Lady that can act as a conduit to stabilize the Kasaavin across dimensions.

The Kasaavin track and spy on humans that are important in the development of computers on Earth, which allows them to understand and refine their erasing process. By 2020, computers and devices have found their way into homes and pockets all across the world and the finishing touches have been put on the Silver Lady, meaning it’s time to enact the plan. When the pieces are all in place, Barton will appear before the world in a press conference (after testing the wipe on his dear old mother first) and activate the Master’s Silver Lady machine, channeling Kasaavin energy through phones and tablets to every human being on Earth at once and wiping the DNA of the human race quicker than a teenager deleting their browser history off the family computer.

The Kasaavin would’ve then taken their first step to dominating Earth’s universe (a goal they stated in last week’s episode), Barton would be left as the ruler of a world with humans relegated to storage devices, and the Master gets the pleasure of knowing he finally brought about the end of humanity, doing away with his two allies for good measure.

How The Doctor Stops The Master

The fly in the Master’s ointment is, as usual, the Doctor. Firstly, it’s important to note that the Master truly believed the Kasaavin were capable of killing the Doctor on Barton’s plane. He didn’t account that the artron energy of a time-traveler would interfere with the deletion process and bring the Doctor over into the Kasaavin world. After the Doctor survived, she happened upon Ada Lovelace (née Gordon) who was being studied by the Kasaavin due to her impact on human technology.

While trying to get back to 2020 through the Kasaavin gateways, the Doctor winds up in the 19th century, thanks to the presence of Ada, where she figures the Silver Lady to be the common denominator and, therefore, the probable key to the Master’s plan. Fast-forwarding to World War II, the Doctor is able to outwit the Master with Lovelace and Noor Inayat Khan, tricking the Nazis into detaining her rival, and thereby allowing the Doctor to procure the Master’s TARDIS. Now with a good idea of what the Master’s intentions are, the Doctor goes back and sabotages the Silver Lady so that it’ll trigger a virus if it senses an army of Kasaavin flowing through it. By doing so, Earth’s devices stop wiping their owners DNA’ and everyone can go back to playing Candy Crush and swiping right.

In a final flourish, the Doctor managed to record the Master describing the Kasaavin as expendable in the 1940s, and she leaves her nemesis to their mercy after exposing his treachery. Thirteen also finds time to go back and ensure her friends’ survival by building in a contingency to Barton’s plane in the past.

More: Doctor Who Mocks Female Doctor Fan Reaction

Doctor Who continues with “Orphan 55” January 12th on BBC and BBC America.