Index: /trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs	(revision 1367)
+++ /trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs	(revision 1368)
@@ -51,14 +51,11 @@
   /// </summary>
   public class Core: MarshalByRefObject {
-    public delegate string GetASnapshotDelegate();
-    //Todo: private + getter/setter removen.
-    public static Object Locker { get; set; }
-    //Todo: ev. Rename to "abortRequested"
-    public static bool ShutdownFlag { get; set; }
-    
-    //Todo: Access modifier
-    Dictionary<long, Executor> engines = new Dictionary<long, Executor>();
-    Dictionary<long, AppDomain> appDomains = new Dictionary<long, AppDomain>();
-    Dictionary<long, Job> jobs = new Dictionary<long, Job>();
+    //Todo: Ask wagner
+    public static Object Locker { get; set; }    
+    public static bool abortRequested { get; set; }
+        
+    private Dictionary<long, Executor> engines = new Dictionary<long, Executor>();
+    private Dictionary<long, AppDomain> appDomains = new Dictionary<long, AppDomain>();
+    private Dictionary<long, Job> jobs = new Dictionary<long, Job>();
 
     private WcfService wcfService;
@@ -70,5 +67,5 @@
     public void Start() {
       Core.Locker = new Object();
-      ShutdownFlag = false;
+      abortRequested = false;
 
       Logging.GetInstance().Info(this.ToString(), "Hive Client started");
@@ -101,5 +98,6 @@
       //Main processing loop     
       //Todo: own thread for message handling
-      while (!ShutdownFlag) {
+      //Rly?!
+      while (!abortRequested) {
         MessageContainer container = queue.GetMessage();
         Debug.WriteLine("Main loop received this message: " + container.Message.ToString());
@@ -113,7 +111,5 @@
     /// </summary>
     /// <param name="container">The Container, containing the message</param>
-    private void DetermineAction(MessageContainer container) {
-      //Todo: Threads aus Threadpool verwenden
-      
+    private void DetermineAction(MessageContainer container) {           
       switch (container.Message) {
         //Server requests to abort a job
@@ -131,6 +127,7 @@
         //Snapshot is ready and can be sent back to the Server
         case MessageContainer.MessageType.SnapshotReady:
-          Thread ssr = new Thread(new ParameterizedThreadStart(GetSnapshot));
-          ssr.Start(container.JobId);          
+          ThreadPool.QueueUserWorkItem(new WaitCallback(GetSnapshot), container.JobId);
+          //Thread ssr = new Thread(new ParameterizedThreadStart(GetSnapshot));
+          //ssr.Start(container.JobId);          
           break;
         //Pull a Job from the Server
@@ -140,10 +137,11 @@
         //A Job has finished and can be sent back to the server
         case MessageContainer.MessageType.FinishedJob:
-          Thread finThread = new Thread(new ParameterizedThreadStart(GetFinishedJob));
-          finThread.Start(container.JobId);          
+          ThreadPool.QueueUserWorkItem(new WaitCallback(GetFinishedJob), container.JobId);
+          //Thread finThread = new Thread(new ParameterizedThreadStart(GetFinishedJob));
+          //finThread.Start(container.JobId);          
           break;     
         //Hard shutdown of the client
         case MessageContainer.MessageType.Shutdown:
-          ShutdownFlag = true;
+          abortRequested = true;
           beat.StopHeartBeat();
           break;
@@ -155,22 +153,27 @@
     
     private void GetFinishedJob(object jobId) {
-      long jId = (long)jobId;
-      //Todo: Don't return null, throw exception!
-      byte[] sJob = engines[jId].GetFinishedJob();
-
-      if (WcfService.Instance.ConnState == NetworkEnum.WcfConnState.Loggedin) {
-        wcfService.ProcessJobResultAsync(ConfigManager.Instance.GetClientInfo().ClientId,
-          jId,
-          sJob,
-          1,
-          null,
-          true);
-      } else {
-        //Todo: locking
-        JobStorageManager.PersistObjectToDisc(wcfService.ServerIP, wcfService.ServerPort, jId, sJob);
-        AppDomain.Unload(appDomains[jId]);
-        appDomains.Remove(jId);
-        engines.Remove(jId);
-        jobs.Remove(jId);
+      long jId = (long)jobId;      
+      try {
+        byte[] sJob = engines[jId].GetFinishedJob();
+
+        if (WcfService.Instance.ConnState == NetworkEnum.WcfConnState.Loggedin) {
+          wcfService.ProcessJobResultAsync(ConfigManager.Instance.GetClientInfo().ClientId,
+            jId,
+            sJob,
+            1,
+            null,
+            true);
+        } else {          
+          JobStorageManager.PersistObjectToDisc(wcfService.ServerIP, wcfService.ServerPort, jId, sJob);
+          lock (Core.Locker) {
+            AppDomain.Unload(appDomains[jId]);
+            appDomains.Remove(jId);
+            engines.Remove(jId);
+            jobs.Remove(jId);
+          }
+        }
+      }
+      catch (InvalidStateException ise) {
+        Logging.GetInstance().Error(this.ToString(), "Exception: ", ise);
       }
     }
@@ -224,6 +227,5 @@
       }
     }
-
-    //Todo: Remove intellgent stuff from the async event and move it to the main thread (message queue)
+    
     //Todo: Seperate this method into 2: Finished jobs and Snapshots
     void wcfService_SendJobResultCompleted(object sender, ProcessJobResultCompletedEventArgs e) {
Index: /trunk/sources/HeuristicLab.Hive.Client.Core/Heartbeat.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Client.Core/Heartbeat.cs	(revision 1367)
+++ /trunk/sources/HeuristicLab.Hive.Client.Core/Heartbeat.cs	(revision 1368)
@@ -73,11 +73,11 @@
       Console.WriteLine("tick");  
       ClientInfo info = ConfigManager.Instance.GetClientInfo();
-      // Todo: remove tempfix for free cores. Fix spelling of freeCores (uppercase)
+      // Todo: remove tempfix for free cores.
 
       HeartBeatData heartBeatData = new HeartBeatData {
         ClientId = info.ClientId,
-        freeCores = info.NrOfCores - (ClientStatusInfo.JobsFetched - ClientStatusInfo.JobsProcessed),
-        freeMemory = 1000,
-        jobProgress = ConfigManager.Instance.GetProgressOfAllJobs()
+        FreeCores = info.NrOfCores - (ClientStatusInfo.JobsFetched - ClientStatusInfo.JobsProcessed),
+        FreeMemory = 1000,
+        JobProgress = ConfigManager.Instance.GetProgressOfAllJobs()
       };
       if (wcfService.ConnState == NetworkEnum.WcfConnState.Failed) {
Index: /trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/Executor.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/Executor.cs	(revision 1367)
+++ /trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/Executor.cs	(revision 1368)
@@ -93,5 +93,5 @@
       //Job isn't finished!
       if (Job.Running) {
-        return null;
+        throw new InvalidStateException("Job is still running");
       } else {
         return SerializeJobObject();
Index: /trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/HeuristicLab.Hive.Client.ExecutionEngine.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/HeuristicLab.Hive.Client.ExecutionEngine.csproj	(revision 1367)
+++ /trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/HeuristicLab.Hive.Client.ExecutionEngine.csproj	(revision 1368)
@@ -66,4 +66,5 @@
     <Compile Include="Executor.cs" />
     <Compile Include="ExecutionEnginePlugin.cs" />
+    <Compile Include="InvalidStateException.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
Index: /trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/InvalidStateException.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/InvalidStateException.cs	(revision 1368)
+++ /trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/InvalidStateException.cs	(revision 1368)
@@ -0,0 +1,24 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace HeuristicLab.Hive.Client.ExecutionEngine {
+  [global::System.Serializable]
+  public class InvalidStateException : Exception {
+    //
+    // For guidelines regarding the creation of new exception types, see
+    //    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp
+    // and
+    //    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp
+    //
+
+    public InvalidStateException() { }
+    public InvalidStateException(string message) : base(message) { }
+    public InvalidStateException(string message, Exception inner) : base(message, inner) { }
+    protected InvalidStateException(
+    System.Runtime.Serialization.SerializationInfo info,
+    System.Runtime.Serialization.StreamingContext context)
+      : base(info, context) { }
+  }
+}
Index: /trunk/sources/HeuristicLab.Hive.Contracts/BusinessObjects/HeartBeatData.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Contracts/BusinessObjects/HeartBeatData.cs	(revision 1367)
+++ /trunk/sources/HeuristicLab.Hive.Contracts/BusinessObjects/HeartBeatData.cs	(revision 1368)
@@ -33,9 +33,9 @@
     public Guid ClientId { get; set; }
     [DataMember]
-    public int freeMemory { get; set; }
+    public int FreeMemory { get; set; }
     [DataMember]
-    public int freeCores { get; set; }
+    public int FreeCores { get; set; }
     [DataMember]
-    public Dictionary<long, double> jobProgress { get; set; } // TODO: define Type 
+    public Dictionary<long, double> JobProgress { get; set; } // TODO: define Type 
   }
 }
Index: /trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs	(revision 1367)
+++ /trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs	(revision 1368)
@@ -190,10 +190,10 @@
       response.Success = true;
       response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_HEARTBEAT_RECEIVED;
-      if (hbData.freeCores > 0 && scheduler.ExistsJobForClient(hbData))
+      if (hbData.FreeCores > 0 && scheduler.ExistsJobForClient(hbData))
         response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.FetchJob));
       else
         response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.NoMessage));
 
-      if (hbData.jobProgress != null) {
+      if (hbData.JobProgress != null) {
         List<Job> jobsOfClient = new List<Job>(jobAdapter.GetActiveJobsOf(clientAdapter.GetById(hbData.ClientId)));
         if (jobsOfClient == null || jobsOfClient.Count == 0) {
@@ -203,5 +203,5 @@
         }
 
-        foreach (KeyValuePair<long, double> jobProgress in hbData.jobProgress) {
+        foreach (KeyValuePair<long, double> jobProgress in hbData.JobProgress) {
           Job curJob = jobAdapter.GetById(jobProgress.Key);
           if (curJob.Client == null || curJob.Client.ClientId != hbData.ClientId) {
