updated tree and added pathfinding