refactoring scan assign