Index: trunk/sources/HeuristicLab.Scripting.Views/3.3/CSharpScriptView.cs
===================================================================
--- trunk/sources/HeuristicLab.Scripting.Views/3.3/CSharpScriptView.cs	(revision 10826)
+++ trunk/sources/HeuristicLab.Scripting.Views/3.3/CSharpScriptView.cs	(revision 10857)
@@ -21,5 +21,4 @@
 
 using System;
-using System.Drawing;
 using System.Windows.Forms;
 using HeuristicLab.Common;
@@ -95,21 +94,7 @@
       base.OnContentChanged();
       if (Content == null) {
-        codeEditor.UserCode = string.Empty;
         variableStoreView.Content = null;
       } else {
-        codeEditor.UserCode = Content.Code;
-        foreach (var asm in Content.GetAssemblies())
-          codeEditor.AddAssembly(asm);
         variableStoreView.Content = Content.VariableStore;
-        if (Content.CompileErrors == null) {
-          compilationLabel.ForeColor = SystemColors.ControlDarkDark;
-          compilationLabel.Text = "Not compiled";
-        } else if (Content.CompileErrors.HasErrors) {
-          compilationLabel.ForeColor = Color.DarkRed;
-          compilationLabel.Text = "Compilation failed";
-        } else {
-          compilationLabel.ForeColor = Color.DarkGreen;
-          compilationLabel.Text = "Compilation successful";
-        }
       }
     }
@@ -117,7 +102,5 @@
     protected override void SetEnabledStateOfControls() {
       base.SetEnabledStateOfControls();
-      compileButton.Enabled = Content != null && !Locked && !ReadOnly;
       startStopButton.Enabled = Content != null && (!Locked || Running);
-      codeEditor.Enabled = Content != null && !Locked && !ReadOnly;
     }
 
Index: trunk/sources/HeuristicLab.Scripting/3.3/CSharpScript.cs
===================================================================
--- trunk/sources/HeuristicLab.Scripting/3.3/CSharpScript.cs	(revision 10826)
+++ trunk/sources/HeuristicLab.Scripting/3.3/CSharpScript.cs	(revision 10857)
@@ -62,5 +62,5 @@
 
     #region Fields & Properties
-    protected CSharpScriptBase CompiledScript;
+    private CSharpScriptBase compiledScript;
 
     public string Filename { get; set; }
@@ -82,4 +82,5 @@
     public CSharpScript() {
       variableStore = new VariableStore();
+      Code = CodeTemplate;
     }
     public CSharpScript(string code)
@@ -94,11 +95,11 @@
 
     protected virtual void RegisterScriptEvents() {
-      if (CompiledScript != null)
-        CompiledScript.ConsoleOutputChanged += CompiledScriptOnConsoleOutputChanged;
+      if (compiledScript != null)
+        compiledScript.ConsoleOutputChanged += CompiledScriptOnConsoleOutputChanged;
     }
 
     protected virtual void DeregisterScriptEvents() {
-      if (CompiledScript != null)
-        CompiledScript.ConsoleOutputChanged -= CompiledScriptOnConsoleOutputChanged;
+      if (compiledScript != null)
+        compiledScript.ConsoleOutputChanged -= CompiledScriptOnConsoleOutputChanged;
     }
 
@@ -106,9 +107,9 @@
 
     public override Assembly Compile() {
-      CompiledScript = null;
+      DeregisterScriptEvents();
+      compiledScript = null;
       var assembly = base.Compile();
       var types = assembly.GetTypes();
-      DeregisterScriptEvents();
-      CompiledScript = (CSharpScriptBase)Activator.CreateInstance(types.First(x => typeof(CSharpScriptBase).IsAssignableFrom(x)));
+      compiledScript = (CSharpScriptBase)Activator.CreateInstance(types.Single(x => typeof(CSharpScriptBase).IsAssignableFrom(x)));
       RegisterScriptEvents();
       return assembly;
@@ -116,29 +117,26 @@
     #endregion
 
-    protected Thread ScriptThread;
+    private Thread scriptThread;
     public virtual void Execute() {
-      if (CompiledScript == null) return;
-      var executeMethod = typeof(CSharpScriptBase).GetMethod(ExecuteMethodName, BindingFlags.NonPublic | BindingFlags.Instance);
-      if (executeMethod != null) {
-        ScriptThread = new Thread(() => {
-          Exception ex = null;
-          try {
-            OnScriptExecutionStarted();
-            executeMethod.Invoke(CompiledScript, new object[] { VariableStore });
-          } catch (ThreadAbortException) {
-            // the execution was cancelled by the user
-          } catch (TargetInvocationException e) {
-            ex = e.InnerException;
-          } finally {
-            OnScriptExecutionFinished(ex);
-          }
-        });
-        ScriptThread.Start();
-      }
+      if (compiledScript == null) return;
+      scriptThread = new Thread(() => {
+        Exception ex = null;
+        try {
+          OnScriptExecutionStarted();
+          compiledScript.Execute(VariableStore);
+        } catch (ThreadAbortException) {
+          // the execution was cancelled by the user
+        } catch (Exception e) {
+          ex = e;
+        } finally {
+          OnScriptExecutionFinished(ex);
+        }
+      });
+      scriptThread.Start();
     }
 
     public virtual void Kill() {
-      if (ScriptThread.IsAlive)
-        ScriptThread.Abort();
+      if (scriptThread.IsAlive)
+        scriptThread.Abort();
     }
 
Index: trunk/sources/HeuristicLab.Scripting/3.3/CSharpScriptBase.cs
===================================================================
--- trunk/sources/HeuristicLab.Scripting/3.3/CSharpScriptBase.cs	(revision 10826)
+++ trunk/sources/HeuristicLab.Scripting/3.3/CSharpScriptBase.cs	(revision 10857)
@@ -52,8 +52,8 @@
 
     protected class EventWriter : TextWriter {
-      private readonly CSharpScriptBase usb;
+      private readonly CSharpScriptBase script;
 
-      public EventWriter(CSharpScriptBase usb) {
-        this.usb = usb;
+      public EventWriter(CSharpScriptBase script) {
+        this.script = script;
       }
 
@@ -64,42 +64,42 @@
       #region Write/WriteLine Overrides
       #region Write
-      public override void Write(bool value) { usb.OnConsoleOutputChanged(value.ToString()); }
-      public override void Write(char value) { usb.OnConsoleOutputChanged(value.ToString()); }
-      public override void Write(char[] buffer) { usb.OnConsoleOutputChanged(new string(buffer)); }
-      public override void Write(char[] buffer, int index, int count) { usb.OnConsoleOutputChanged(new string(buffer, index, count)); }
-      public override void Write(decimal value) { usb.OnConsoleOutputChanged(value.ToString()); }
-      public override void Write(double value) { usb.OnConsoleOutputChanged(value.ToString()); }
-      public override void Write(float value) { usb.OnConsoleOutputChanged(value.ToString()); }
-      public override void Write(int value) { usb.OnConsoleOutputChanged(value.ToString()); }
-      public override void Write(long value) { usb.OnConsoleOutputChanged(value.ToString()); }
-      public override void Write(object value) { usb.OnConsoleOutputChanged(value.ToString()); }
-      public override void Write(string value) { usb.OnConsoleOutputChanged(value); }
-      public override void Write(string format, object arg0) { usb.OnConsoleOutputChanged(string.Format(format, arg0)); }
-      public override void Write(string format, object arg0, object arg1) { usb.OnConsoleOutputChanged(string.Format(format, arg0, arg0)); }
-      public override void Write(string format, object arg0, object arg1, object arg2) { usb.OnConsoleOutputChanged(string.Format(format, arg0, arg1, arg2)); }
-      public override void Write(string format, params object[] arg) { usb.OnConsoleOutputChanged(string.Format(format, arg)); }
-      public override void Write(uint value) { usb.OnConsoleOutputChanged(value.ToString()); }
-      public override void Write(ulong value) { usb.OnConsoleOutputChanged(value.ToString()); }
+      public override void Write(bool value) { script.OnConsoleOutputChanged(value.ToString()); }
+      public override void Write(char value) { script.OnConsoleOutputChanged(value.ToString()); }
+      public override void Write(char[] buffer) { script.OnConsoleOutputChanged(new string(buffer)); }
+      public override void Write(char[] buffer, int index, int count) { script.OnConsoleOutputChanged(new string(buffer, index, count)); }
+      public override void Write(decimal value) { script.OnConsoleOutputChanged(value.ToString()); }
+      public override void Write(double value) { script.OnConsoleOutputChanged(value.ToString()); }
+      public override void Write(float value) { script.OnConsoleOutputChanged(value.ToString()); }
+      public override void Write(int value) { script.OnConsoleOutputChanged(value.ToString()); }
+      public override void Write(long value) { script.OnConsoleOutputChanged(value.ToString()); }
+      public override void Write(object value) { script.OnConsoleOutputChanged(value.ToString()); }
+      public override void Write(string value) { script.OnConsoleOutputChanged(value); }
+      public override void Write(string format, object arg0) { script.OnConsoleOutputChanged(string.Format(format, arg0)); }
+      public override void Write(string format, object arg0, object arg1) { script.OnConsoleOutputChanged(string.Format(format, arg0, arg0)); }
+      public override void Write(string format, object arg0, object arg1, object arg2) { script.OnConsoleOutputChanged(string.Format(format, arg0, arg1, arg2)); }
+      public override void Write(string format, params object[] arg) { script.OnConsoleOutputChanged(string.Format(format, arg)); }
+      public override void Write(uint value) { script.OnConsoleOutputChanged(value.ToString()); }
+      public override void Write(ulong value) { script.OnConsoleOutputChanged(value.ToString()); }
       #endregion
 
       #region WriteLine
-      public override void WriteLine() { usb.OnConsoleOutputChanged(Environment.NewLine); }
-      public override void WriteLine(bool value) { usb.OnConsoleOutputChanged(value + Environment.NewLine); }
-      public override void WriteLine(char value) { usb.OnConsoleOutputChanged(value + Environment.NewLine); }
-      public override void WriteLine(char[] buffer) { usb.OnConsoleOutputChanged(new string(buffer) + Environment.NewLine); }
-      public override void WriteLine(char[] buffer, int index, int count) { usb.OnConsoleOutputChanged(new string(buffer, index, count) + Environment.NewLine); }
-      public override void WriteLine(decimal value) { usb.OnConsoleOutputChanged(value + Environment.NewLine); }
-      public override void WriteLine(double value) { usb.OnConsoleOutputChanged(value + Environment.NewLine); }
-      public override void WriteLine(float value) { usb.OnConsoleOutputChanged(value + Environment.NewLine); }
-      public override void WriteLine(int value) { usb.OnConsoleOutputChanged(value + Environment.NewLine); }
-      public override void WriteLine(long value) { usb.OnConsoleOutputChanged(value + Environment.NewLine); }
-      public override void WriteLine(object value) { usb.OnConsoleOutputChanged(value + Environment.NewLine); }
-      public override void WriteLine(string value) { usb.OnConsoleOutputChanged(value + Environment.NewLine); }
-      public override void WriteLine(string format, object arg0) { usb.OnConsoleOutputChanged(string.Format(format, arg0) + Environment.NewLine); }
-      public override void WriteLine(string format, object arg0, object arg1) { usb.OnConsoleOutputChanged(string.Format(format, arg0, arg1) + Environment.NewLine); }
-      public override void WriteLine(string format, object arg0, object arg1, object arg2) { usb.OnConsoleOutputChanged(string.Format(format, arg0, arg1, arg2) + Environment.NewLine); }
-      public override void WriteLine(string format, params object[] arg) { usb.OnConsoleOutputChanged(string.Format(format, arg) + Environment.NewLine); }
-      public override void WriteLine(uint value) { usb.OnConsoleOutputChanged(value + Environment.NewLine); }
-      public override void WriteLine(ulong value) { usb.OnConsoleOutputChanged(value + Environment.NewLine); }
+      public override void WriteLine() { script.OnConsoleOutputChanged(Environment.NewLine); }
+      public override void WriteLine(bool value) { script.OnConsoleOutputChanged(value + Environment.NewLine); }
+      public override void WriteLine(char value) { script.OnConsoleOutputChanged(value + Environment.NewLine); }
+      public override void WriteLine(char[] buffer) { script.OnConsoleOutputChanged(new string(buffer) + Environment.NewLine); }
+      public override void WriteLine(char[] buffer, int index, int count) { script.OnConsoleOutputChanged(new string(buffer, index, count) + Environment.NewLine); }
+      public override void WriteLine(decimal value) { script.OnConsoleOutputChanged(value + Environment.NewLine); }
+      public override void WriteLine(double value) { script.OnConsoleOutputChanged(value + Environment.NewLine); }
+      public override void WriteLine(float value) { script.OnConsoleOutputChanged(value + Environment.NewLine); }
+      public override void WriteLine(int value) { script.OnConsoleOutputChanged(value + Environment.NewLine); }
+      public override void WriteLine(long value) { script.OnConsoleOutputChanged(value + Environment.NewLine); }
+      public override void WriteLine(object value) { script.OnConsoleOutputChanged(value + Environment.NewLine); }
+      public override void WriteLine(string value) { script.OnConsoleOutputChanged(value + Environment.NewLine); }
+      public override void WriteLine(string format, object arg0) { script.OnConsoleOutputChanged(string.Format(format, arg0) + Environment.NewLine); }
+      public override void WriteLine(string format, object arg0, object arg1) { script.OnConsoleOutputChanged(string.Format(format, arg0, arg1) + Environment.NewLine); }
+      public override void WriteLine(string format, object arg0, object arg1, object arg2) { script.OnConsoleOutputChanged(string.Format(format, arg0, arg1, arg2) + Environment.NewLine); }
+      public override void WriteLine(string format, params object[] arg) { script.OnConsoleOutputChanged(string.Format(format, arg) + Environment.NewLine); }
+      public override void WriteLine(uint value) { script.OnConsoleOutputChanged(value + Environment.NewLine); }
+      public override void WriteLine(ulong value) { script.OnConsoleOutputChanged(value + Environment.NewLine); }
       #endregion
       #endregion
Index: trunk/sources/HeuristicLab.Scripting/3.3/Script.cs
===================================================================
--- trunk/sources/HeuristicLab.Scripting/3.3/Script.cs	(revision 10826)
+++ trunk/sources/HeuristicLab.Scripting/3.3/Script.cs	(revision 10857)
@@ -49,5 +49,5 @@
     [Storable]
     private string code;
-    public virtual string Code {
+    public string Code {
       get { return code; }
       set {
@@ -58,11 +58,6 @@
     }
 
-    private string compilationUnitCode;
-    public virtual string CompilationUnitCode {
-      get { return compilationUnitCode; }
-    }
-
     private CompilerErrorCollection compileErrors;
-    public virtual CompilerErrorCollection CompileErrors {
+    public CompilerErrorCollection CompileErrors {
       get { return compileErrors; }
       private set {
@@ -79,12 +74,10 @@
       : base(original, cloner) {
       code = original.code;
-      compilationUnitCode = original.compilationUnitCode;
       if (original.compileErrors != null)
         compileErrors = new CompilerErrorCollection(original.compileErrors);
     }
-    public Script() {
-      name = ItemName;
-      description = ItemDescription;
-      code = CodeTemplate;
+    public Script()
+      : base("Script", "An empty script.") {
+      code = string.Empty;
     }
     public Script(string code)
@@ -128,5 +121,4 @@
           IndentString = "  ",
         });
-      compilationUnitCode = writer.ToString();
       return CodeProvider.CompileAssemblyFromDom(parameters, unit);
     }
