refactored group shortest path