Bug Fix: Wait for an event object instead of Sleep(1).