refactoring, add response handler