added duration check to play, moved vars