In observational studies of treatment effects, matched samples have traditionally been constructed using two tools, namely close matches on one or two key covariates and close matches on the propensity score to stochastically balance large numbers of covariates. Here we propose a third tool, fine balance, obtained using the assignment algorithm in a new way. We use all three tools to construct a matched sample for an ongoing study of provider specialty in the treatment of ovarian cancer. Fine balance refers to exact balance of a nominal covariate, often one with many categories, but it does not require individually matched treated and control subjects for this variable. In the example the nominal variable has 72 = 9 x 8 categories formed from 9 possible years of diagnosis and 8 geographic locations or SEER sites. We obtain exact balance on the 72 categories and close individual matches on clinical stage, grade, year of diagnosis, and other variables using a distance, and stochastically balance a total of 61 covariates using a propensity score. Our approach finds an optimal match that minimizes a suitable distance subject to the constraint that fine balance is achieved. This is done by defining a special patterned distance matrix and passing it to a subroutine that solves the optimal assignment problem, which optimally pairs the rows and columns of a matrix using a polynomial time algorithm. In the example we used the function Proc Assign in SAS. A new theorem shows that with our patterned distance matrix, the assignment algorithm returns an optimal, finely balanced matched sample whenever one exists, and otherwise returns an infinite distance, indicating that no such matched sample exists.