By late 1806 Hegel had completed his first major work, the Phenomenology of Spirit (published 1807), which showed a divergence from his earlier, seemingly more Schellingian, approach. Schelling, who had left Jena in 1803, interpreted a barbed criticism in the Phenomenology’s preface as aimed at him, and their friendship abruptly ended. The occupation of Jena by Napoleon’s troops as Hegel was completing the manuscript restricted the activities of the university and Hegel departed. Now without a university appointment he worked for a short time, apparently very successfully, as an editor of a newspaper in Bamberg, and then from 1808–1815 as the headmaster and philosophy teacher at a gymnasium (high school) in Nuremberg. During his time at Nuremberg he married and started a family, and wrote and published his Science of Logic. In 1816 he managed to return to his university career by being appointed to a chair in philosophy at the University of Heidelberg, but shortly after, in 1818, he was offered and took up the chair of philosophy at the University of Berlin, the most prestigious position in the German philosophical world. In 1817, while in Heidelberg he published the Encyclopaedia of the Philosophical Sciences, a systematic work in which an abbreviated version of the earlier Science of Logic (the Encyclopaedia Logic or Lesser Logic) was followed by the application of its principles to the philosophy of nature and the philosophy of spirit. In 1821 in Berlin Hegel published his major work in political philosophy, Elements of the Philosophy of Right, based on lectures given at Heidelberg but ultimately grounded in the section of the Encyclopaedia Philosophy of Spirit dealing with objective spirit. During the following ten years up to his death in 1831 Hegel enjoyed celebrity at Berlin, and published subsequent versions of the Encyclopaedia. After his death versions of his lectures on philosophy of history, philosophy of religion, aesthetics, and the history of philosophy were published.