corrected scan function signature