Justification, as extensive as is possible, is given for our previously published nonlocal approximation for exchange and correlation. Some new exact limits for atoms and interfaces are obtained, as well as formal quantitative criteria for the validity of the local-density approximation and the gradient corrections to it. The scheme is applied to planar surface calculations, as well as to extensive self-consistent calculations of energies and densities in atoms. The results compare favorably, in every case attempted, to experimental and exact results that are available. A method is devised for separating exchange from correlation in atoms within the Kohn-Sham method, and is tested favorably against exact-exchange calculations. Finally, we apply these results to atoms using exact exchange plus our appropriately separated correlation expression. The results give atomic total energies to accuracies of ~+/-0.01 Ry, and typically reduce the local-density-approximation error in density by an order of magnitude.