remove unused imports
cosmetics
use events for signaling/waiting in worker thread
reduce delay for visibility check