Working version with modal and promis