Refactoring with chained promise.