What role does slavery play from the formation of the nation to the 1840s?