added when for promise coordination