new routing algorithm supporting choosing between types