Implement pathfinding