refine routing algo