Refactored to easier to read promise chaining