making the promise chain logic much sturdier