Guard timeout adjustment against illegal values.
Add comment to certain confusing points.