improving factory for dataset