More elegant retry logic.