Moved this function to its own shell script.