tidy up creation of new dataset function