added function to generate records