Changed to write out a frame before updating the automaton