refactor promises, 100% coverage