Move and document some functions.