updated for promises