New scripting function