added ability to specify total number of requests