The script now uses subprocess instead of threads.