scan: Refactored scan method