Minor refactoring to several classes.