updateS function

Update latent states