Moved hooks inside captureResponse()