Change the approach for AI do not use thread