Smarter pathfinding solution