He shrank the Navy, for example, deeming it unnecessary in peacetime, and incorporated a fleet of inexpensive gunboats intended only for local defense to avoid provocation against foreign powers. After two terms, he had lowered the national debt from $83 million to $57 million. Domestic affairs Jefferson pardoned several of those imprisoned under the Alien and Sedition Acts. Congressional Republicans repealed the Judiciary Act of 1801, which removed nearly all of Adams's "midnight judges" from office. A subsequent appointment battle led to the Supreme Court's landmark decision in Marbury v. Madison, asserting judicial review over executive branch actions. Jefferson appointed three Supreme Court justices: William Johnson (1804), Henry Brockholst Livingston (1807), and Thomas Todd (1807). Jefferson strongly felt the need for a national military university, producing an officer engineering corps for a national defense based on the advancement of the sciences, rather than having to rely on foreign sources for top grade engineers with questionable loyalty. 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. 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. Foreign affairs (1801–1805) First Barbary War American merchant ships had been protected from Barbary Coast pirates by the Royal Navy when the states were British colonies. After independence, however, pirates often captured U.S. merchant ships, pillaged cargoes, and enslaved or held crew members for ransom. Jefferson had opposed paying tribute to the Barbary States since 1785. In 1801, he authorized a U.S. Navy fleet under Commodore Richard Dale to make a show of force in the Mediterranean, the first American naval squadron to cross the Atlantic. Following the fleet's first engagement, he successfully asked Congress for a declaration of war. The subsequent "First Barbary War" was the first foreign war fought by the U.S. Pasha of Tripoli Yusuf Karamanli captured the , so Jefferson authorized