Added promise enabled while loop