Meanwhile, Wergeland worked as a librarian at the University Library for a small wage, from January 1836. In late autumn 1838, King Carl Johan offered him a small "royal pension" that nearly doubled his salary. Wergeland accepted this as a payment for his work as a "public teacher". This pension gave Wergeland enough income to marry and settle down. His marriage the same spring made him calmer, and he applied again, this time for the new job as head of the national archive. The application is dated January 1840. Eventually, he obtained it, and was employed from 4 January 1841 until he had to retire in the autumn of 1844.