Generic automaton improvement and event logic implementation