fixed errors in states, added end symbol capability