A year ago, it would have been unimaginable for the House to pass a bill to curtail the government’s abusive surveillance practices. The documents leaked by Edward Snowden, however, finally shocked lawmakers from both parties into action, producing promises that they would stop the government from collecting the telephone data of ordinary Americans and would bring greater transparency to its domestic spying programs.

Unfortunately, the bill passed by the House on Thursday falls far short of those promises, and does not live up to its title, the U.S.A. Freedom Act. Because of last-minute pressure from a recalcitrant Obama administration, the bill contains loopholes that dilute the strong restrictions in an earlier version, potentially allowing the spy agencies to continue much of their phone-data collection.

Still, the bill finally begins to reverse the trend of reducing civil liberties in the name of fighting terrorism, as embodied in various versions of the Patriot Act. And if the Senate fixes its flaws, it could start to rebuild confidence that Washington will get the balance right.

The bill moves the collection of phone data from the government to the phone companies, where it belongs. It limits the ability of the National Security Agency to request calling records more than two contacts away from a terrorism suspect, rather than allowing it to go through the records of anyone even tangentially connected to a suspect. It requires that opinions or orders from the Foreign Intelligence Surveillance Court be made public, unless they would clearly expose intelligence sources or harm national security. Even then, summaries of the opinions would have to be provided.