The death of Joubert at the Battle of Novi and the return of Napoleon Bonaparte from the Egypt campaign put an end to this project, but Sieyès regained influence by reaching a new understanding with Bonaparte. In the coup of 18 Brumaire, Sieyès and his allies dissolved the Directory, allowing Napoleon to seize power. Thereafter, Sieyès produced the constitution which he had long been planning, only to have it completely remodeled by Bonaparte, who thereby achieved a coup within a coup – Bonaparte's Constitution of the Year VIII became the basis of the French Consulate of 1799–1804.