Moved AI to dedicated thread. Still minor model bugs.