Adds logic to NFA.java