I'll suggest this script to be rid of while loop and replace it with the /play command for the list part.