Synchronized with main changeset 73032, preparing for 4.0 release. moving types between namespaces, cleaning up documentation, adding tests.