A better way of measuring homophily