automate state transitions