Scan method refactoring using block.