adapting code for play next when finished playing