more complicated statemachine so far