Refactoring of recognizer