The name of the function is misleading. It doesn't only count the checked packages, but also enables the button. Maybe a better name would be checkPackageState or something like that.