Who successfully negotiated the final terms of the treaty of guadalupe hidalgo