refactored promise nesting