Broke out the various support functions into a new file.