properly sort by specifity