refactoring scanning conditions