updating state engine