factored out data generation