refactored retry logic