Added test + feature for specifying attempts to retry.
Updated README and documentation with examples.