flatten_datasets. and tests.