added update states based on the real states in js
merged