Use machine state to handle transitions