Refactor base classes.