make the possible-hosts function more readable