refactor createDatastore