Split out functions that will be more easily used by the webapp.