retry on server error
refactoring