Adding retry and safe bail out on connection error
Merge pull request #1 from krazybean/fixed_retry_failure

Adding retry and safe bail out on connection error