Changed DFA function