improve and implement dataProvider function

improve and implement dataProvider function