refactoring embed subtitles script