In 1979, a family hunting for arrowheads in an Idaho cave made a grisly discovery: the headless, burlap-shrouded torso of a man in a shallow grave. In the ensuing years, explorers and law enforcement would find other macabre pieces of the puzzle—a mummified hand, an arm, and two legs.

But for 40 years, two central questions remained unanswered: Who was the man and who killed him?

Thanks to DNA technology, authorities believe they have now solved half the mystery. The dead man in Buffalo Cave has been identified as Joseph Henry Loveless, a murderous bootlegger born in 1870 and likely killed in 1916.

Investigators from the DNA Doe Project were able to use genetic material from the remains to trace John Doe’s family tree and figure out who he was. It took more than a dozen volunteer genealogists 2,000 hours to examine the relationships of more than 30,000 relatives and figure out where the man in the cave fit in.

“He ended up having a lot of matches that were first cousins three times removed, which is very unusual in this type of scenario,” Lee Bingham Redgrave, a forensic genealogist with the project, told the Associated Press. “One by one, we eliminated certain candidates and kept coming back to him.”

On Dec. 13, they were able to confirm their suspicion by comparing his DNA with that of an 86-year-old man who turned out to be Loveless’ grandson.

Loveless was a murder victim—but also a murderer.

Born to Mormon settlers, he was a bootlegger with a string of aliases and a knack for escaping from jail. In 1916, he was arrested for the ax killing of his wife, Agnes, the mother of their four children. He used a saw hidden in his shoes to saw through the jail bars and go on the run, the DNA Doe Project said. The clothes he was wearing when he bolted match the description of the clothing found on the body in the cave.

A headstone for Loveless was found in the family plot, but there was no death date on it, and no remains.

Although officials have put a name to the body, the case is not yet closed. They still haven’t found Loveless’ head—and they haven’t determined who killed him and tossed most of him in the cave.