Added data paramter, more work on data generation