Improved pathfinding