A recent study published by Stanford University looks at why cliques thrive in some schools more than others. Some schools are fiercely segregated by age, class, ethnic background, fashion choices—and others are not. What educational environment would, say, make the goth and the jock more likely to be friends and not segregated into cliques?

The findings of university researcher Daniel A. McFarland suggest a surprising answer to that question. It’s less about the students and more about the schools themselves—their size, the diversity of the student population and the way they control students.

In bigger schools, teens are exposed to a much more diverse student body, which would make you think they’d be more likely to form friendships outside the typical barriers of cliques. But that’s not the case, according to McFarland, who suggests that students are more anxious about making friends in larger schools and cling to those most like them. “Bigger schools offer a broader range of potential friends, as well as greater exposure to people who are different,” the study says. “It's a mixture of freedom and uncertainty that spurs students to cluster by race, gender, age and socioeconomic status.”

McFarland tells the Atlantic, "In smaller schools, and in smaller classrooms, you force people to interact, and they are less hierarchical, less cliquish, and less self-segregated.”

School size isn’t the only thing effecting cliques, though. Schools with an openness to choice tend to spur the formation of cliques and “social-status hierarchies.” But in schools that put a strong focus on academics and force students (of different backgrounds) into cooperating, teens are less likely to form friendships based on social attitudes. "In classrooms with assigned seating, you’re forced to sit next to someone whom you wouldn’t otherwise interact, and that tends to break down the tendency to segregate by background,” McFarland tells the Atlantic.

As the study puts it, “a more rigid school setting can sometimes promote more open-mindedness in making friends — a potentially valuable quality in adulthood.”

To sum it up, the goth and the jock are more likely to become friends in a smaller school, with smaller classrooms and forced student interactions facilitated by the school. In such an environment, they’re unable to pick friends based on their first, superficial judgments.