refactoring promise aggregation