The Obama administration is preparing legislation that would end the National Security Agency’s widespread collection of Americans’ phone data while, preserving the government’s ability to gain information about terrorists, senior officials said. The legislation would allow data about phone calls made to and from Americans to be kept with the phone companies. The companies would not be required to hold the data longer than they normally would, the officials said according to The Washington Post. The effort comes as the administration is up against a deadline set by President Obama in January, when he directed his subordinates to find a way to end the government’s mass collection of phone data, a program that has stirred controversy since it was revealed through a leak to the news media in June. He gave them until Friday to come up with options. The proposal, which is still being worked on, would require phone companies to provide data about suspected terrorist numbers under a court order, officials said. It would include making available on a real-time, ongoing basis data about any new calls made to or from the suspect’s number after the order is served an idea embraced by NSA leaders, officials said. The Foreign Intelligence Surveillance Court, which oversees the program, would have to approve each number as having likely ties to a suspected terrorist or terrorist group. Officials said the administration has decided to renew the current program for at least one more 90-day cycle. The current orders expire Friday. Under the program, the government collects telephone numbers and call times and dates, but not call content.