Improved cleanup.py, now handles automatic groups.

Improvements to the script `cleanup.py` that cleans up the groups that are
inactive. Now it also takes care of correctly clean up automatic groups.