Move some functions to classes.