Refactored sweep-classes.py part.