Functional backoff/retry

Backoff/retry with injected mapping from call result to success criterion, and backoff times as a parameter. (New version with the backoff in the right place!)