extract retry logic into separate class