moved variables into properties, added a lock around the “scan” to track if operation already in progress