Refactored out common classes.