improve StateMachine.h
make StateMachine.h dependency-free