I think this assumption is pretty broken. What if the type is `null`?  We don't define any order in the types when they are specified in the URL but this code assume that there is an order. I think we have to make this explicit which type should be used.