refactoring, js file for request calls