Basic AI support
Added backtracking to the pathfinder