Moved around some functions between classes.