Complex sentence: Underwood had been a Whig, but as that party was disintegrating, joined the Liberty Party in the 1840s because of his anti-slavery views, and unsuccessfully ran for U.S. Representative and then District Attorney in 1847.
Split into simpler sentences: Underwood had been a Whig, but as that party was disintegrating, joined the Liberty Party in the 1840s because of his anti-slavery views. He unsuccessfully ran for U.S. Representative and then District Attorney in 1847.