redesigned statemachine hierachy