Refactor ScanValue.