I think the conditions on ``$sourceType`` can be removed here. Using dist when there is no sourceType or the opposite is handled by the ``$types`` array now. No need to check these cases for the order of preference