moved every function of the main class into smaller classes.