retry pattern cleanup & refactoring