Lawyers have tossed everything but the kitchen sink at President Donald Trump’s executive order on immigration this week.

More than 40 lawsuits have been filed since Trump first signed the order on Jan. 27 suspending entry to the United States for individuals from seven predominantly Muslim countries in the Middle East and Africa.

The cases range from habeas corpus petitions on behalf of travelers to class actions backed by immigration and civil rights groups to suits that leverage the credibility—and resources—of state governments in Washington, Virginia, Massachusetts and New York. They assert violations of the U.S. Constitution and statutes including the Immigration and Nationality Act and the Religious Freedom Restoration Act.

What looks like legal chaos on the surface may have an upside for advocates by establishing more avenues to a successful outcome. With little active coordination, at least in the initial phases, lawyers across the country have been testing the legal theories that may get them past two main hurdles—standing and the reluctance of courts to second-guess executive branch decisions related to national security.

Matt Adams, legal director of the Northwest Immigrant Rights Project, which has partnered with organizations including the American Civil Liberties Union on two class actions, said Thursday that the flurry of activity is starting to coalesce.

“It’s important for us to coordinate our efforts and see who’s already challenging what issues,” Adams said. “That being said, it has happened so quickly, and so many people are experiencing immediate harm, it’s inevitable you’ll have overlapping lawsuits because you have attorneys across the country trying to protect their clients.”

The bulk of cases filed so far have been habeas corpus petitions, brought over the weekend after immigrants were detained or deported at U.S. airports. Many of those have been voluntarily dismissed, presumably because the petitioner has since been released.

Other suits, brought by advocacy groups like the ACLU, the Council on American-Islamic Relations and the American Immigration Council, seek to represent a class of individuals who have been or could be impacted from the order. Framing their suits as class actions allows advocates to obtain rulings with broader impact. On Jan. 28, for example, U.S. District Judge Ann Donnelly in the Eastern District of New York granted an emergency motion to stay removals as part of a class action brought by the ACLU.

At least five class actions have been filed, some involving the same advocacy groups. That’s because so many people have been affected, Adams said.

“The executive order is wreaking havoc in a lot of different contexts,” he said. “It’s not just one group of individuals, and every group of individuals presents its own issues.”

One of the Northwest Immigrant Rights Project’s class actions, for instance, seeks to represent individuals whose visa applications were suspended due to the order.

The major hurdle for class actions in the immigration context is establishing that the lead plaintiffs behind the case have legal standing to sue in federal courts, said Stephen Yale-Loehr, a professor at Cornell Law School.

One tactic that’s already being employed in several suits is finding a U.S. citizen to sue on behalf of their loved ones, instead of litigating directly on behalf of foreign nationals.

In a class action filed on Monday by three immigration groups, the lead plaintiffs are two U.S. citizens and one lawful permanent resident who live in Washington and California. They are joined in the case by their minor children, who are in the process of getting an immigrant visa but live in one of the seven countries identified in Trump’s order.

U.S. citizens make better plaintiffs, acknowledged Mary Kenney, senior staff attorney at the American Immigration Council. “Certainly the U.S. citizen and LPR plaintiffs in the United States have significant ties and will not have standing issues,” Kenney said. But she also insisted they have been harmed by the order, which “is tearing families apart.”

Plaintiffs lawyers also could point to the order as an “anti-Muslim ban” in order to allege a policy common to all class members, said Kevin Johnson, dean of the University of California, Davis, School of Law. Lawyers advanced a similar argument in a class action against Maricopa County, Arizona, Sheriff Joe Arpaio to demonstrate that his office racially profiled Latinos in its patrols.

Many of the class actions challenging Trump’s order use the term “anti-Muslim ban” in their complaints. (Trump has insisted that his order “is not a Muslim ban.”)

In a case brought on Monday by the state of Washington, Attorney General Bob Ferguson cited the numbers of employees at Microsoft, Expedia and Amazon with temporary work visas who come from the seven countries at issue in the order. Raising the economic impact of the order could be designed to overcome standing issues, said Geoffrey Hoffman, director of the Immigration Clinic at the University of Houston Law Center.

In a sense it’s taking a lesson from the AGs who repeatedly challenged actions from the Obama administration.

Attorneys general from 26 states overcame a similar standing hurdle in their case against federal policies giving legal status to 4 million immigrants. “They alleged an economic connection to the executive agency’s actions to their citizens or residents in their respective states,” Hoffman said. “So similarly here, you’re going to have a real connection also to the economic impact of these executive actions on the state.”

In a supplemental brief filed Wednesday, Ferguson cited Texas v. United States in arguing that the state of Washington had standing due to lost tax revenues and other costs.

Beyond standing, legal experts predict that the federal government will assert a hard-to-penetrate national security defense. Trump’s order invokes the Immigration and Nationality Act’s provisions allowing the president to prohibit entry into the United States of foreign nationals to protect U.S. interests. And immigration falls under the plenary power doctrine, which holds that the legislative and executive branches, not the courts, have the power to regulate immigration.

“I could see the federal government saying, ‘There’s no room for judicial review here,’” Johnson said. “The doctrine is still good law, and this may give the Supreme Court in the end a chance to revisit this law.”

But the powers of the president aren’t unlimited. Many of the lawsuits cite other provisions of the Immigration and Nationality Act designed to prevent discrimination in the issuance of visas, plus numerous constitutional violations that could challenge the president’s powers.

“Even though the president has broad powers, that power is not unlimited,” Hoffman said. “You have to keep in mind we still have limitations: the First Amendment, due process, equal protection, retroactivity—a lot of issues that I think can be brought to bear.”