Refactored the gateway requester and test.