[186] He signed the Military Peace Establishment Act on March 16, 1802, thus founding the United States Military Academy at West Point. The Act documented in 29 sections a new set of laws and limits for the military. Jefferson was also hoping to bring reform to the Executive branch, replacing Federalists and active opponents throughout the officer corps to promote Republican values.[187]
Jefferson took great interest in the Library of Congress, which had been established in 1800.  He often recommended books to acquire.  In 1802, Congress authorized President Jefferson to name the first Librarian of Congress, and formed a committee to establish library rules and regulations. Congress also granted the president and vice president the right to use the library.[188]

Foreign affairs (1801–1805)
First Barbary War
Main article: First Barbary War
Barbary Coast of North Africa 1806. Left is Morocco at Gibraltar, center is Tunis, and right is Tripoli.
American merchant ships had been protected from Barbary Coast pirates by the Royal Navy when the states were British colonies.[189] After independence, however, pirates often captured U.S. merchant ships, pillaged cargoes, and enslaved or held crew members for ransom. 