Move out some functions