added updateStates method