refactoring scan