Udated ScriptConvert function