America, 1840–1895 – Expansion and consolidation