Move function out of server and into generation portion.