refactor Pathfinder