Dynamical adjustment of the cosmological constant