The combination of two key ideas helped break open the decades-old "Golden State Killer" case.
One of which was a forensic pathologist's insistence on making duplicate rape kits and the second was the use of a genealogy website to find relatives based on the mystery killer's DNA, according to investigator Paul Holes.
Here's how the search for a terrifying rapist and serial killer unfolded, and how those two puzzle pieces finally led to an arrest.
An investigator obsessed
When Holes, who recently retired after decades on the investigation, took on the "Golden State Killer" case, he quickly became obsessed with the mystery, noting the meticulous way the attacks were planned.
As the first break-ins and rapes unfolded in Northern California in the late '70s, the "Golden State Killer" -- then known as the "East Area Rapist" before he progressed to murder -- was attacking women who were home alone, Holes said.
"He always had a mask on. He always had gloves on. And he typically would have a knife or some other weapon with him," Holes said. "He would basically be telling 'em, 'Do what I say or I'll kill you.' He would make them bind their hands behind their back. He would bind their ankles."
Fifteen attacks later, a Northern California newspaper article noted how the mystery rapist only broke in when no man was home, Holes said.
"What does he do in attack number 16? He attacks with a man in the house. He's following himself in the press," Holes said. "This guy has the self-confidence in his abilities ... to be able to go into a house, entire families in there, with the threat of this male present, and take control."
"He changes his M.O. to accommodate this additional threat inside the house," Holes explained. "When he comes into the house, the couple is asleep in bed. He'll wake them up. ... He would put the gun in the flashlight so the victims can see."
After tying the couple up, the rapist would put an object on the man's back as a makeshift alarm system, telling the male victim that if he heard the object moving he would start killing people, according to Holes.
During the rape, "in many cases, what he would do is he'd turn the TV on in the family room with no sound and drape a towel over the TV so he would have that low-level lighting. He wanted to see the victim. He wanted to see the fear in her face. He wanted to see her body as he's sexually assaulting her," Holes said.
But after one attempted attack didn't go as planned -- when a male victim confronted the rapist -- the attacker fled Northern California for Southern California, where he progressed to murder, Holes said.
During the crime spree, which lasted from 1976 to 1986 with no arrests, police say the "Golden State Killer," committed 12 murders, at least 50 rapes and multiple home burglaries throughout the state.
One especially brutal attack was in Southern California in 1980. Charlene Smith was raped before she and her husband were bludgeoned to death.
Watch the full story on "20/20" this Friday, May 4 at 10 p.m. ET/PT
'That turned out to be a goldmine for us'
Years later, forensic technology advanced, and in 2001 DNA linked Northern California rapes and Southern California killings, Holes said.
Holes later came up with what would become a key idea to find a suspect, plugging the mystery killer's DNA into GEDMatch, a genealogy website that allows users to upload DNA profiles.
And Holes said having enough DNA to use for this test was thanks to forensic pathologist Dr. Peter Speth -- who responded to that gruesome 1980 rape and murder of Charlene Smith and her husband -- and who always made duplicate rape kits.
"It seemed to me that it was a very risky business to have only one set. When I made duplicate rape kits it was to be sure that if one set, for some reason, was destroyed or lost or used up, that there would be the second set," Speth told "20/20." "To my knowledge, there are no other medical examiners who make duplicate rape kits."
It turned out to be "a goldmine for us," Holes said.
"Because that second kit had sat in the coroner's possession for 38 years untouched," he explained. "And so, the swabs collected from Charlene Smith's body were pristine and contained a lot of our offender's DNA."
In January, Holes said he created an undercover GEDMatch account, uploaded the DNA profile of the "Golden State Killer" to allow "the GEDMatch servers to do their magic and produce the list of people that potentially shared some DNA."
Holes found third cousins, fourth cousins and other distant relatives of the mystery killer on the genealogy website, and investigators started building the family tree back to 1800s.
GEDmatch said it wasn't "approached by law enforcement or anyone else" about the use of its database to identify the suspected "Golden State Killer."
"It has always been GEDmatch’s policy to inform users that the database could be used for other uses, as set forth in the Site Policy," the company said in a statement.
"While the database was created for genealogical research, it is important that GEDmatch participants understand the possible uses of their DNA, including identification of relatives that have committed crimes or were victims of crimes," the company said. "If you are concerned about non-genealogical uses of your DNA, you should not upload your DNA to the database and/or you should remove DNA that has already been uploaded."
'I was finally able to put a face to this guy I've been hunting'
What investigators knew about the mystery killer's age, appearance and location helped them narrow the family tree down, eventually zeroing in on a potential suspect: Joseph DeAngelo, a former police officer, who was fired from the force in 1979, three years after the attacks began.
"Me being a law enforcement officer, it was sickening, thinking that somebody would hide behind the badge and commit these types of attacks," Holes said. "Especially considering now you are hunting a guy that has the law enforcement training behind him."
In April, after collecting two DNA samples from DeAngelo, investigators had a confirmed match to their mystery attacker, Holes said.
"I was finally able to put a face to this guy I've been hunting," he said.
DeAngelo was arrested last week, taken into custody at his home in Sacramento County, where the crime spree started.
DeAngelo has not yet entered a plea and returns to court later this month.
Decades after he responded to the Smiths' gruesome double murder and rape, where he had collected the key double DNA samples, Speth said he was overcome with relief.
"I would love to hug every one of the family members who finally have closure," Speth said.