I'm dismayed that you've completely rewritten this file.  Ashish and I went back and forth on it about 4 times and I was finally comfortable with it. It is not how I would have done it, but I could live with it.  Now you've written another version that is completely different than I would have done.

It took me a long time to figure out what is going on here and convince myself that this would work. I'm still not completely certain about the timeout logic, and now I'm out of time for the day and won't be able to complete the review.

I don't like that the input object gets new properties set on it and is used as the handle. Please at least make a shallow copy of the input object and return that.