Simplify scan function