slight modify for scan function uses the second arg value as file input