Improve timeout handling, minor cleanup to timeouts

[merge]