query creator, and potentially better adviser. fix for shortest path