improved route sorting