working on foreach in .then