small refactoring and jshint fix for datasourceFactory func