updating state diagram