Beauregard returned from Mexico in 1848. For the next 12 years, he was in charge of what the Engineer Department called "the Mississippi and Lake defenses in Louisiana." Much of his engineering work was done elsewhere, repairing old forts and building new ones on the Florida coast and in Mobile, Alabama. He also improved the defenses of Forts St. Philip and Jackson on the Mississippi River below New Orleans. He worked on a board of Army and Navy engineers to improve the navigation of the shipping channels at the mouth of the Mississippi. He created and patented an invention he called a "self-acting bar excavator" to be used by ships in crossing bars of sand and clay. While serving in the Army, he actively campaigned for the election of Franklin Pierce, the Democratic presidential candidate in 1852, and a former general in the Mexican War who had been impressed by Beauregard's performance at Mexico City. Pierce appointed Beauregard as superintending engineer of the U.S. Custom House in New Orleans, a huge granite building that had been built in 1848. As it was sinking unevenly in the moist soil of Louisiana, Beauregard had to develop a renovation program. He served in this position from 1853 to 1860 and stabilized the structure successfully.