Fix setTimeout bug

The original setTimeout calls are buggy.  If the variable (states)
changes after the timeout is called, the updated states are sent!
(Thanks to Seok Min)
Put back ability to adjust delay

The code for adjusting delay at the Bot was removed.
This revision put it back in so that we can play with the
simulated delay to server for the Bot as well.