Moved bulk of cscope-related code to a worker class that extends threading.Thread while ensuring that all ST2-related calls happen only from one function that will execute in the main thread.