Dynamics and stability of communities