changed to match ai.cpp