Adding retry logic

This turned out to be a bigger change than I had anticipated since
retrying forces us to be more specific about the type of errors that
we need  to handle.
Merge pull request #5 from usermindinc/ak-add_retry_logic

Adding retry logic