Until his speech at the CIA yesterday in which he praised the CIA and intelligence community, President Donald Trump had been openly critical of the intelligence community as a whole, and former CIA Director John Brennan in particular.

So, what will his relationship with the intelligence community be like now that he’s in the Oval Office? And will he try to reform the intelligence community more to his liking?

Other presidents have left their mark on the intelligence community, as has Congress. This week, Trump inherits the most sophisticated, integrated national intelligence platform in the world.

It is not perfect, but understanding the history of the major reforms and ways in which it can be improved even further is a good starting point.

In the wake of Watergate and the passage of the Foreign Intelligence Surveillance Act of 1978, there was a need to improve the collection and analysis of intelligence and to clearly delineate the roles of the intelligence community.

Reform attempts in the late 1970s were essentially punitive and restrictive measures designed to limit the intelligence community’s activities following allegations of ethically suspect or illegal operations by members of the intelligence community.

But on Dec. 4, 1981, President Ronald Reagan signed Executive Order 12333, which defined, in a positive way, the conduct of the U.S. intelligence community. Executive Order 12333 clearly delineated the roles and responsibilities of agencies and individuals within the intelligence community.

The objective was to ensure that the president and National Security Council received necessary and timely information “on which to base decisions concerning the conduct and development of foreign, defense, and economic policy, and the protection of the United States national interests from foreign security threats.”

To achieve this goal, Executive Order 12333 promoted analytical competition in the intelligence community and directed it to use all means “consistent with applicable United States law and this Order, and with full consideration of the rights of United States persons” to detect and counter espionage, terrorism, and other threats.

By defining the role of every intelligence agency, limiting when and how the agencies could conduct foreign surveillance, and directing the attorney general to create further policies governing what information can be collected, Reagan not only made the intelligence community more responsive to oversight by elected officials, he also gave each agency clear responsibilities and goals.

This empowered the intelligence community to work effectively to generate information necessary to make important policy and national security decisions.

These reforms have had enduring value. Executive Order 12333 has enabled every president to provide clear direction to the intelligence community regarding its organization and objectives for the past 35 years.

The first major legislative reform of the intelligence community came in 2004 when President George W. Bush signed the Intelligence Reform and Terrorism Prevention Act into law. This bill was sparked largely by congressional dissatisfaction with the intelligence community’s failure to prevent 9/11 and its flawed 2002 National Intelligence Estimate regarding Iraqi weapons of mass destruction.

Several investigations and reports—most notably the 9/11 Commission report—had concluded that the intelligence community needed significant changes to its organizational structure to better control and coordinate the complex web of intelligence agencies. Congress acted quickly on these recommendations.

To strengthen the center of the intelligence community, the Intelligence Reform and Terrorism Prevention Act established the Office of the Director of National Intelligence. The principal intelligence adviser to the president, the director serves as the nominal head of the intelligence community to ensure closer collaboration of the 16 other individual intelligence agencies.

The law also established, in statute, the National Counterterrorism Center to integrate all intelligence operations and analysis pertaining to terrorism. Additionally, it established the Information Sharing Environment to further ensure coordination and cooperation among federal departments and intelligence agencies.

Finally, the law included provisions to protect privacy and civil liberties and created an independent Privacy and Civil Liberties Oversight Board.

Despite these reforms, the law did not fully address the challenges facing the intelligence community. The intelligence community’s subsequent failure to predict the Arab Spring, the aggressive military actions of Russian President Vladimir Putin and China, and the San Bernardino massacre and other terrorist attacks against the U.S. suggests that much work remains to be done.

Two main challenges stand out. First, the director of national intelligence can foster collaboration and cooperation between intelligence agencies, but has limited authority to direct. Thus, there is no central position that can enforce change throughout the intelligence community.

Second, while the law helped facilitate cooperation and coordination among the separate agencies, it did not address the varied organizational structures within the agencies.

While each agency is structured to best achieve its own mission, none has attempted to help create an analytical and communications structure that would also make the intelligence community more effective as a whole. Future reforms of the intelligence community should take these two challenges head-on.

Beyond these structural issues, intelligence community reform efforts should also consider the significant analytical challenges facing the agencies. The failure to predict the Arab Spring indicates a broad misunderstanding of a series of strategic shifts—not just a single event.

Analytical challenges stem from internal pressures to maintain consensus, a failure to encourage specialization and expertise, a lack of emphasis on open-source information, and a strategic analysis gap. The next series of intelligence community reforms should address these problems.

Trump will have a lot of executive discretion as president on how to use the intelligence community, starting with his director of national intelligence, former Sen. Dan Coats, R-Ind.

As a highly successful businessman, Trump will quickly learn that the director’s office works best with a very small but highly competent staff that promotes integration and collaboration among the 16 intelligence agencies under its charge and does not conduct operational activities itself.

The director of national intelligence would be the key player for implementing any intelligence community reforms dealing with security clearance, intelligence acquisition, and information sharing.

How Trump utilizes Coats, and how retired Lt. Gen. Michael Flynn (the national security adviser) impacts and influences the new president, remains to be seen.