Retry mechanism

Fixes #16