Refactored NFA related code to a separate module to make code organization a bit cleaner