Clean up ScriptContext handling