Split out some functions.