This dissertation analyzes the effect of smaller classes on student performance using student-level test score data from the state of Texas, focusing on three specific issues: heterogeneity in the returns to smaller classes across a score distribution of students, the relationship between class size and students' moving decisions, and the connection between smaller classes and schools' class division procedures. I first examine evidence of heterogeneity in the returns to class size reductions across a score distribution of students. I divide students into decile groups based on their previous year test scores, and I estimate the returns to smaller classes for each of the deciles. The empirical evidence supports the hypothesis that there are significant differences in students' responses to class size, based on their previous test scores. I then model the class size effect simultaneously with students' decisions to switch schools, which is important because movers compose a substantial fraction of the dataset, and because class size effects vary between movers and nonmovers. Recognizing that students move for different reasons, only some of which are school-related, I present a two-type moving model in which students are categorized as endogenous movers or exogenous movers. I estimate the model estimated using maximum likelihood. The results reveal key biases in traditional estimates of the moving effect and suggest significant differences in the class size effect across mover types. I also explore the class size effect in conjunction with schools' decisions to sort students into different classes. Using student-level data in which students are linked to specific classes, I disentangle the class size effect from the sorting effect. Including a variable indicating the sorting index of a school decreases the magnitude and significance of the class size effect. I also examine different types of sorting. The findings suggest that sorting students into more homogeneous groups is beneficial for both high and low scoring students.