added generation function as a separate file.