better automaton