Add data parameter to the generate function to override default data with stored data