The Treaty of Guadalupe Hidalgo of 1848 ceded the territories of California and New Mexico to the United States for $18.5 million (which included the assumption of claims against Mexico by settlers). The Gadsden Purchase in 1853 added southern Arizona, which was needed for a railroad route to California. In all Mexico ceded half a million square miles (1.3 million km2) and included the states-to-be of California, Utah, Arizona, Nevada, New Mexico, and parts of Colorado and Wyoming, in addition to Texas. Managing the new territories and dealing with the slavery issue caused intense controversy, particularly over the Wilmot Proviso, which would have outlawed slavery in the new territories. Congress never passed it, but rather temporarily resolved the issue of slavery in the West with the Compromise of 1850. California entered the Union in 1850 as a free state; the other areas remained territories for many years.