Adjustments to the timeout js code