Refactor retries
Merge pull request #49 from segmentio/more-retries

Refactor retries