refactor to use local data source after ajax call