modified to use the request 'data' event