tree search now fully correct