 He returned to the Barbary Coast in December 1798, as special agent to William Eaton.In 1802, he was appointed US Consul to Tunis and Tripoli.He participated in the negotiation of additional treaties with Algiers, Tunis, and Tripoli.