lots of new code, including getting the min counts and scattering the new state labels