The construction can be outlined, roughly, as follows. One starts by considering a principal fiber bundle P with gauge group G over a manifold M. Given a connection on the bundle, and a metric on the base manifold, and a gauge invariant metric on the tangent of each fiber, one can construct a bundle metric defined on the entire bundle. Computing the scalar curvature of this bundle metric, one finds that it is constant on each fiber: this is the "Kaluza miracle". One did not have to explicitly impose a cylinder condition, or to compactify: by assumption, the gauge group is already compact. Next, one takes this scalar curvature as the Lagrangian density, and, from this, constructs the Einstein–Hilbert action for the bundle, as a whole. The equations of motion, the Euler–Lagrange equations, can be then obtained by considering where the action is stationary with respect to variations of either the metric on the base manifold, or of the gauge connection. Variations with respect to the base metric gives the Einstein field equations on the base manifold, with the energy–momentum tensor given by the curvature (field strength) of the gauge connection. On the flip side, the action is stationary against variations of the gauge connection precisely when the gauge connection solves the Yang–Mills equations. Thus, by applying a single idea: the principle of least action, to a single quantity: the scalar curvature on the bundle (as a whole), one obtains simultaneously all of the needed field equations, for both the spacetime and the gauge field.