Retry loop should now be tail recursive