untested version of 'pathfinding'