@xiangli-cmu I just looked at this again and realized that the `break` statements inside the `select` will only break out of the `select`, not the inner `for` loop. We need to check for the state change at the end of the inner `for` loop in addition to the end of the outer `for` loop.

Also, we need to have a `bool` to track whether the timeout occurred since the break inside the timeout isn't actually doing anything either.

I can make these changes later or feel free to do them if you understand what I'm talking about.