Since the early 2000s, Cosby has been dogged by allegations of sexual misconduct from dozens of women, with some allegations going back as far as the 1960s. As many as 50 women have accused Cosby of a variety of sexual crimes, including rape, sexually assaulting women whom he allegedly drugged, sexual battery, child sexual abuse, and sexual misconduct.

In almost all cases, the alleged crimes took place so long ago that the statute of limitations has passed, and Cosby can’t be prosecuted. However, one criminal case has managed to stick: the allegations brought against Cosby by Andrea Constand, a Temple University women’s basketball coach at the time of the alleged sexual assault.

Constand alleged that she and Cosby became friends, and she grew to view him as a mentor. In 2004, she went to Cosby’s mansion in suburban Philadelphia, where she alleges that Cosby gave her pills and wine. After blacking out, she woke up to find Cosby fondling her.

In January, 2005, Bruce Castor, the Montgomery County District Attorney at the time, found insufficient evidence to bring criminal charges against Cosby.

In March, 2005, Cosby gave a deposition as part of a civil suit brought against him by Constand and over a dozen other women. The specifics of the deposition were to remain confidential. However, by 2015, Cosby was again faced with a slew of allegations of sexual misconduct, allegations which he vehemently, and publicly, denied. Constand’s attorneys argued that Cosby’s statements violated the terms of the confidentiality agreement, and the contents of the deposition were unsealed.

In December, 2015, the newly elected district attorney, Kevin R. Steele, reviewed the deposition and determined that there was enough evidence contained in it to instate criminal charges against Cosby. On December 15, 2015, a warrant was issued for Cosby’s arrest.

Cosby’s attorneys are angling for the criminal charges against the comedian to be thrown out, largely on the basis of technicalities — or at least, some earlier decisions that are open to interpretation.

The first issue is whether or not Castor’s 2005 decision not to prosecute Cosby was intended to prevent Cosby from ever being criminally charged. According to MSN, Castor claims that he and Walter M. Phillips, Jr. — Cosby’s lawyer at the time — worked out an oral “non-prosecution” agreement. However, it’s unclear whether there is anyone who can corroborate that account (Phillips died in 2015), or even if it will hold up in court.

The second issue is whether or not Cosby’s testimony in his civil deposition can be used as evidence in his criminal trial. If the judge rules that it’s inadmissible, that could significantly damage the prosecution’s case.

If the judge allows the case to proceed, a trial date could still be months away, as Cosby and his attorneys file further appeals.

Meanwhile, Cosby faces multiple civil suits from various women who claim that Bill Cosby’s denials defamed them. Civil cases against Cosby are moving forward in California and Massachusetts; a civil suit against Cosby in Pennsylvania was thrown out in January.