Got AI working better with path detection and some additional logging