  We present an improved algorithm for tabulating class groups of imaginary
quadratic fields of bounded discriminant. Our method uses classical class
number formulas involving theta-series to compute the group orders
unconditionally for all $\Delta \not \equiv 1 \pmod{8}.$ The group structure is
resolved using the factorization of the group order. The $1 \bmod 8$ case was
handled using the methods of \cite{jacobson}, including the batch verification
method based on the Eichler-Selberg trace formula to remove dependence on the
Extended Riemann Hypothesis. Our new method enabled us to extend the previous
bound of $|\Delta| < 2 \cdot 10^{11}$ to $2^{40}$. Statistical data in support
of a variety conjectures is presented, along with new examples of class groups
with exotic structures.
