Refactoring + removing unused code
Automatic retry in case of rejected promise