Merge "Refactor how timeouts are calculated."