Make promises-based pseudo-synchronous code more readable