The hierarchical high school of John Hughes’ movies and Mean Girls is ubiquitous in pop culture, but it is not universal in real life. A new study finds that some schools—based on their size, organizational structure, and academic climate—are more likely to foster cliques than others.

Cliques form because people are often attracted to people of the same race, class, gender, and age as themselves—this is not a novel idea, and in sociology, this concept is called homophily (“love of the same”). But Daniel McFarland, an education professor at Stanford and the lead author of the study, discovered that this tendency to segregate is much more prevalent in large schools and schools that provide students with more academic freedom. A news release about the study explains: “Schools that offer students more choice—more elective courses, more ways to complete requirements, a bigger range of potential friends, more freedom to select seats in a classroom—are more likely to be rank-ordered, cliquish, and segregated.”

McFarland, whose study will be published in December in American Sociological Review, said in a phone interview that in college, when he and his peers would reflect on high school, some recalled segregated, hierarchical social scenes, while others remembered much more egalitarian environments. “Everyone had a different version of what adolescent society was like,” he said, and so he and his coauthors were interested in comparing different high schools, to see how students’ networks were shaped by the organization of their school.

The researchers used two datasets for the study: one to examine friendships on the classroom level, and the other to explore schoolwide relationships. The classroom-level dataset compared two extremely different schools. One was a traditional, tracked, Midwestern high school made up of mostly white students. The other was a magnet school in a “distressed” neighborhood of a large city that was diverse along racial and economic lines, but “homogenous in achievement.”

For the schoolwide study, an existing dataset was used that, among many other survey questions, asked thousands of adolescents at 144 different schools about their friendships. The reason for two datasets, McFarland explained, was to determine if the students formed similar networks in their classes as they did throughout the entire school. “A friend in class seems to be a fairweather friend, a weaker tie,” he said.

McFarland and his team found that, in contrast with the larger more flexible schools, schools with a more rigid academic atmosphere usually fostered friendships based on intellectual interests and common activities. (This was true both on the classroom level and on a school-wide level.) Throughout the study, large schools are often equated with less rigid schools, because most of these more stringent institutions were private schools, and thus were smaller.

Because smaller schools inherently offered a smaller pool of potential friends, they also limited friendships based on “external” criteria (race, gender, status, etc...). To some degree, this is intuitive: There are fewer friends to choose from, so excluding people becomes riskier.

The takeaway, McFarland said, is that “the way we organize schools will have repercussions” for students’ interpersonal relationships. Teachers and administrators may think they cannot influence their students’ social fabric, but they can. Schools can “indirectly direct” the way that social networks form, by providing more or fewer choices for students. This influence can be used to promote student friendships across intellectual or academic commonalities, rather than external traits. McFarland thinks this knowledge can be used for the better: By designing schools that encourage students to associate based on common interests, we can avoid “creating boundaries that correspond with inequities that already exist in society.”

McFarland cautioned against concluding from this study that a small, rigid school is best for all students. Throughout this research, he grew concerned that “the prescription seemed to be layering all sorts of forced activities so we prevent all of these castes. I don’t think that’s necessarily what we want.” He even declined to say definitively that cliques are harmful to students’ development. (There are plenty of “folk theories” about this, he said, but not enough actual empirical evidence.)

McFarland believes that educators can still learn a great deal from these findings about organizing schools and curricula, even if more research still needs to be done. He said that teachers and administrators must now aim to find a curriculum “that encourages students to associate based on intellectual interests that span gender, race, and class.” Because, McFarland said, “Most reasonable people know that that isn’t a good basis for forming a relationship.”