added sendRequest, refactoring