This paper describes a number of ways to improve on the standard method of measuring the two-point correlation, or covariance, function of large-scale structure in the universe. (1) It is shown that the statistic commonly used to estimate the covariance function has the defect that its uncertainty on large scales is limited by the uncertainty in the mean density. An alternative estimator is proposed which does not suffer from this limitation. The alternative estimator should be more accurate all on scales, but particularly on large scales where the covariance function is small. (2) Use of the sample mean biases the estimate of the covariance function by missing out variance on scales comparable to the scale of the sample. A revised estimator of the covariance function is proposed which allows missing large-scale variance to be restored. (3) It is shown from first principles how to estimate the uncertainties in the covariance function of a sample. A practical way to carry out the error analysis is suggested. (4) An approximate minimum-variance pair weighting for the calculation of the covariance function is derived, and a practical implementation is suggested. (5) The question of the calculation of background pair counts is discussed, with emphasis on the problem of the anisotropy of the redshift covariance function. Various analytic results are presented on angular integrals.