President Barack Obama praised the United States’ commitment to privacy Friday and said the U.S. government’s mass surveillance programs would be put on a new legal footing before he leaves office in January 2017.

“As the world’s oldest continuous constitutional democracy, I think we know a little bit about trying to protect people’s privacy,” Obama said, standing next to German Chancellor Angela Merkel during a press conference at the White House.

Merkel politely avoided giving direct answers to questions about the National Security Agency tapping her personal cellphone.

Obama described Merkel as “one of my closest friends on the world stage” and said whistleblower Edward Snowden’s disclosures about U.S. spying on Merkel strained that relationship, which “pained” him.

“She should not doubt, and the German people should not doubt, how seriously we take these issues,” Obama said, promising greater bilateral cooperation and more restrained conduct.

“I’m absolutely committed that by the time I leave this office, we’re going to have a stronger legal footing and international framework for how we are doing business in the intelligence sphere,” Obama said.

Read More: