sort types by specificity before preference