trying a closure on the scan functions