Add retry logic. Update tests.