With its 5-4 decision in Janus v. AFSCME, the Supreme Court has just imposed a right-to-work regime on public workers everywhere in the country — a profound blow to the union movement.

As a result of the decision, public sector unions are now legally obligated to provide representation to workers and yet legally prohibited from requiring anyone to pay for that representation.

Before Janus, public sector employees who didn’t want to be union members still had to pay their share of what it cost the union to represent them. This “fair share fee” was calculated to include the worker’s share of the union’s collective bargaining expenses and also the costs the union incurred providing individual representation to the worker in grievance and arbitration proceedings. The fee could not include any costs of the union’s political program.

This system balanced a range of critical rights and interests. It respected every individual worker’s right not to become a union member, and each individual worker’s right not to subsidize political activity with which she disagreed. But it also aimed to prevent workers from free-riding on the dues paid by other workers: because unions must, by law, represent everyone equally, if there’s no requirement to pay your fair share, then unions would end up providing costly representation to lots of people who decided not to pay for it.

But that’s precisely the situation that Janus establishes. Employees can now choose whether they want to pay for union services or whether they would rather receive precisely the same services for free. Unless something changes in response to the Court’s decision, public sector unions will face a funding crisis that threatens their very existence. In the words of Justice Elena Kagan, the Court’s decision “creates a collective action problem of nightmarish proportions.”

The decision is a harsh blow, but it need not be a deadly one

There should be no mistake: This decision is the culmination of a sustained attack by political forces determined to destroy the labor movement and undermine the movement’s capacity to counterbalance corporate economic and political power.

By throwing out a system that lasted for more than 40 years, it has ushered in a period of uncertainty for state and local governments that want to provide efficient and effective services. Yet it would be a mistake to take the doom-and-gloom commentary too far. Despite what some of the more pessimistic pundits have suggested, this need not mark the end of the public-sector labor movement.

For one thing, the public sector unions that are impacted by Janus have been preparing for years for this decision, and many are ready with innovative approaches to attempt to adjust to the changes it puts in place. Even more important, however, there are a number of steps that sympathetic state legislatures can take to prevent Janus from destroying unions.

Janus may well render the current system unworkable, but states can step in to create new systems that make union finances sustainable.

A simple accounting fix could work wonders

The simplest, and the most effective, move would be for states to change, quite subtly, the accounting system for union dues. Currently, the accounting system works like this: Unions win raises, or wage premiums, for public employees of about 17 percent on average. (That is, unionized public-sector workers make 17 percent more than their non-unionized counterparts.) Agency fees — the fees the Court invalidated in Janus — are a tiny fraction (about 2 percentage points) of the union premium. Employers pay this 2 percent to workers, but require that the employees immediately pay that money back to the union.

The upshot is that, instead of seeing a 17 percent wage premium, unionized workers get something like a 15 percent bump and must pay the 2 percent difference to the union. Because this 2 percent fee passes through employee paychecks on the way from the public employer to the union, however, the Supreme Court concluded workers were being “compelled” to support union speech; that’s the constitutional problem, as the Court sees it.

But if public employers simply paid the 2 percent directly to the unions — giving the same 15 percent raise to employees but not channeling the extra 2 percent through employee paychecks — then there would be no possible claim that employees were being compelled to do anything, and thus no constitutional problem.

To be clear, nothing of substance would change: Workers would still get the same 15 percent wage premium, the union would still get the same 2 percent, and the public employer would pay exactly the same amount.

The fact that states can make the constitutional problem with agency fees disappear simply by changing the accounting system shows how silly the Janus Court’s constitutional holding really is. But that doesn’t alter the fact that states can save union finances in this straightforward way.

Giving unions better access to workers

States also should position unions to overcome the free-rider problem that Janus creates. They can do this by ensuring that unions have the opportunity to make the case, directly to workers, that they should pay dues even though they’re not required to pay them. Among the critical steps that states can take is making sure unions have early, ready access in the workplace to the workers they are legally obligated to represent.

California and New York already have passed legislation that gives unions the opportunity to talk with employees during their orientations and to remove any disincentives for new employees to take advantage of that opportunity. States should also strengthen laws that give unions timely access to contact information for public employees so the unions can provide those employees with the information they need to make an informed decision about paying dues.

Administrative delays can lead unions to be unaware that new employees have arrived and new employees’ unfamiliarity with their workplace culture can inhibit them from reaching out to the union for information. The New York law, for example, avoids these pitfalls by providing the union with contact information within 30 days of a new employee being hired, setting up a meeting between the union and new employees so the employee doesn’t have to ask for it, and prohibiting employers from charging leave for the time an employee spends in these initial meetings.

If people don’t pay, unions should be able to withhold some services

State laws should also empower unions to choose not to represent, in some circumstances, people who don’t pay union dues. Under the law in many states today, unions are required to provide costly representation to individuals in grievance and arbitration proceedings even when those individual workers have declined to pay dues. That should change. When a worker declines to pay those dues, unions should be free to decline to offer that worker individual representation services, or to charge the workers the actual cost of the representation.

New York is already moving in this direction by allowing public sector unions to refuse to represent free-riders in grievance proceedings, so long as the worker has the right to bring in outside representation. All states should allow unions this basic right: to charge workers who want representation in grievance and arbitration proceedings and to refuse to represent anyone who doesn’t pay.

States also should let unions become more entrepreneurial. Unions run highly effective training programs, for example, and states could subcontract with them for their training needs. In turn, that would help unions generate income from sources other than dues and fees.

Similarly, unions have lots of experience running benefits programs, and they could fill some of the financial gaps that Janus will create by collecting fees from state governments to administer such programs on behalf of public employees.

Whatever specific reforms move to the fore, the Janus decision will test whether state legislatures and executives recognize that public sector unions make government work efficiently and effectively for citizens — as they indisputably do.

Teachers this year have shown us the power that public sector workers possess, even in states hostile to unions. Unions inspired elected officials, workers, and communities to recognize the relationship between the quality of public sector jobs and the quality of public services.

It is just this spirit that we need in the wake of Janus. The Supreme Court has let workers down. It is time for state legislatures to step up.

Benjamin Sachs is the Kestnbaum professor of labor and industry at Harvard Law School, and editor in chief of OnLabor.org. Sharon Block is executive director of the labor and worklife program at Harvard Law.

The Big Idea is Vox’s home for smart discussion of the most important issues and ideas in politics, science, and culture — typically by outside contributors. If you have an idea for a piece, pitch us at thebigidea@vox.com.