What were the sources of americans' optimism as they emerged from the war of 1812 and how did the american government capitalize on this optimism?