Seperated out the code to generate the data.