Refactorings to help ScriptingEngine impl