added support for timeout = 0
Added exponential backoff