For any prime p > 3, the strongest lower bounds for the number of imaginary quadratic fields with discriminant down down to -X for which the class group has trivial (non-trivial) p-torsion are due to Kohnen and Ono (Soundararajan). I will discuss recent refinements of these classic results in which we consider the imaginary quadratic fields whose class number is indivisible (divisible) by p such that a given finite set of primes factor in a prescribed way. We prove a lower bound for the number of such fields with discriminant down to -X which is of the same order of magnitude as Kohnen and Ono's (Soundararajan's) results. For the indivisibility case, we rely on a result of Wiles establishing the existence of imaginary quadratic fields with trivial p-torsion in their class groups satisfying almost any given finite set of local conditions, and a result of Zagier which says that the Hurwitz class numbers are the Fourier coefficients of a mock modular form.