Refactoring matching braces classifier.