For a given timelike displacement vector, the covariant Hamiltonian quasilocal energy expression requires a proper choice of reference spacetime. We propose a program for determining the reference by embedding a neighborhood of the two-sphere boundary in the dynamic spacetime into a Minkowski reference, so that the two-sphere is embedded isometrically, and then extremizing the energy to determine the embedding variables. Applying this idea to Schwarzschild spacetime, we found that for each given future timelike displacement vector our program gives a unique energy value. The static observer measures the maximal energy. Applied to the Friedmann-Lemaitre-Robertson-Walker spacetime, we find that the maximum energy value is non-negative; the associated displacement vector is the unit dual mean curvature vector; and the expansion of the two-sphere boundary matches that of its reference image. For these spherically symmetric cases the reference determined by our program is equivalent to isometrically matching the geometry at the two-sphere boundary and taking the displacement vector to be orthogonal to the spacelike constant coordinate time hypersurface, like the timelike Killing vector of the Minkowski reference.