Maximal hypersurfaces and foliations of constant mean curvature in general relativity