Bowing to concerns from both the public and members of Congress, President Obama announced Friday his administration would seek to overhaul a controversial program run by the National Security Agency that collected huge numbers of Americans’ phone records in bulk.

In a much-anticipated speech at the Department of Justice, the president, while defending the government’s collection of so-called metadata and emphasizing it had not been abused, said he understood worries about privacy over the program and would seek to change it so that the government no longer held all the data and the process for U.S. officials to access it would be much more stringent.

“I believe critics are right to point out that without proper safeguards, this type of program could be used to yield more information about our private lives, and open the door to more intrusive bulk collection programs,” he said. “They also rightly point out that although the telephone bulk collection program was subject to oversight by the Foreign Intelligence Surveillance Court and has been reauthorized repeatedly by Congress, it has never been subject to vigorous public debate.”

He added, “For all these reasons, I believe we need a new approach. I am therefore ordering a transition that will end the Section 215 bulk metadata program as it currently exists.”

Obama also announced a series of other changes, that like the metadata shift, came in response to complaints about U.S. national security practices that much of the public learned about because of the leaks by former federal contractor Edward Snowden. The U.S. will no longer monitor the phone calls of the leaders of countries it is friendly with, like German Chancellor Angela Merkel, unless there is a compelling national security reason to do so.

The administration will attempt to limit the scope and time of  “National Security Letters” that require private companies to turn over data to the government. It will seek additional steps to make sure that the concerns of private citizens are heard in decisions of the Foreign Intelligence Surveillance Court, which critics have said is currently essentially a rubber-stamp for the government when it seeks warrants in national security investigations.

The changes represent a major shift from the president. When Snowden’s leaks first came to light, Obama strongly defended these programs and emphasized both that they had major national security benefits and that the president and his team had no interest in monitoring the individual calls of Americans.

But as he indicated in his speech, Obama’s thinking on these issues has evolved. He is more open to changes, even though, as he said in his remarks, he is not certain about what all of them should be. On the metadata issue, he listed a series of possible changes, like storing the data with a private company instead of the government, but noted the concerns with many of these ideas.

He pledged on several issues to work with Congress. (This is actually possible, as the debate about the NSA is not as politically polarized and divided by party as other issues.)

At the same time, Obama does not believe he has violated the law by implementing the program or contradicted the promises he made on the campaign trail in 2008 to reverse Bush-era national security practices.

“We increased oversight and auditing, including new structures aimed at compliance. Improved rules were proposed by the government and approved by the Foreign Intelligence Surveillance Court. And we sought to keep Congress continually updated on these activities,” Obama said.

The president still believes Snowden broke the law, and is not backing down from the administration’s policy of prosecuting Snowden if he returns to the United States. Obama criticized Snowden in his speech.

“I’m not going to dwell on Mr. Snowden’s actions or motivations,” Obama said. But he added, “the sensational way in which these disclosures have come out has often shed more heat than light, while revealing methods to our adversaries that could impact our operations in ways that we may not fully understand for years to come.”