Clean up the logic in setting timeouts a bit, and the logging as well.