fix all matches count
more refactoring