Added test + feature for specifying attempts to retry.

Patch for Issue #2